Skip to content

Commit

Permalink
Merge pull request #987 from n9/feature/GetQueueElements
Browse files Browse the repository at this point in the history
AsyncQueue<T>.ToArray() made public (#986)
  • Loading branch information
AArnott committed Feb 11, 2022
2 parents 26b09cb + 17cfe3a commit 7e66041
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Microsoft.VisualStudio.Threading/AsyncQueue`1.cs
Expand Up @@ -324,7 +324,7 @@ public bool TryDequeue([MaybeNullWhen(false)] out T value)
/// <summary>
/// Returns a copy of this queue as an array.
/// </summary>
internal T[] ToArray()
public T[] ToArray()
{
lock (this.SyncRoot)
{
Expand Down
@@ -1,3 +1,4 @@
Microsoft.VisualStudio.Threading.AsyncQueue<T>.ToArray() -> T[]!
Microsoft.VisualStudio.Threading.AsyncReaderWriterLock.AsyncReaderWriterLock(Microsoft.VisualStudio.Threading.JoinableTaskContext? joinableTaskContext, bool captureDiagnostics = false) -> void
Microsoft.VisualStudio.Threading.AsyncReaderWriterResourceLock<TMoniker, TResource>.AsyncReaderWriterResourceLock(Microsoft.VisualStudio.Threading.JoinableTaskContext? joinableTaskContext, bool captureDiagnostics) -> void
Microsoft.VisualStudio.Threading.JoinableTaskContext.IsMainThreadMaybeBlocked() -> bool
Expand Down
@@ -1,3 +1,4 @@
Microsoft.VisualStudio.Threading.AsyncQueue<T>.ToArray() -> T[]!
Microsoft.VisualStudio.Threading.AsyncReaderWriterLock.AsyncReaderWriterLock(Microsoft.VisualStudio.Threading.JoinableTaskContext? joinableTaskContext, bool captureDiagnostics = false) -> void
Microsoft.VisualStudio.Threading.AsyncReaderWriterResourceLock<TMoniker, TResource>.AsyncReaderWriterResourceLock(Microsoft.VisualStudio.Threading.JoinableTaskContext? joinableTaskContext, bool captureDiagnostics) -> void
Microsoft.VisualStudio.Threading.JoinableTaskContext.IsMainThreadMaybeBlocked() -> bool
Expand Down
@@ -1,3 +1,4 @@
Microsoft.VisualStudio.Threading.AsyncQueue<T>.ToArray() -> T[]!
Microsoft.VisualStudio.Threading.AsyncReaderWriterLock.AsyncReaderWriterLock(Microsoft.VisualStudio.Threading.JoinableTaskContext? joinableTaskContext, bool captureDiagnostics = false) -> void
Microsoft.VisualStudio.Threading.AsyncReaderWriterResourceLock<TMoniker, TResource>.AsyncReaderWriterResourceLock(Microsoft.VisualStudio.Threading.JoinableTaskContext? joinableTaskContext, bool captureDiagnostics) -> void
Microsoft.VisualStudio.Threading.JoinableTaskContext.IsMainThreadMaybeBlocked() -> bool
Expand Down
Expand Up @@ -25,6 +25,7 @@ public void JustInitialized()
Assert.Equal(0, this.queue.Count);
Assert.True(this.queue.IsEmpty);
Assert.False(this.queue.Completion.IsCompleted);
Assert.Empty(this.queue.ToArray());
}

[Fact]
Expand All @@ -34,6 +35,7 @@ public void Enqueue()
this.queue.Enqueue(value);
Assert.Equal(1, this.queue.Count);
Assert.False(this.queue.IsEmpty);
Assert.Single(this.queue.ToArray());
}

[Fact]
Expand All @@ -43,6 +45,7 @@ public void TryEnqueue()
Assert.True(this.queue.TryEnqueue(value));
Assert.Equal(1, this.queue.Count);
Assert.False(this.queue.IsEmpty);
Assert.Single(this.queue.ToArray());
}

[Fact]
Expand Down

0 comments on commit 7e66041

Please sign in to comment.