Skip to content

Commit

Permalink
[Obsolete][CS0618] AddFirst "This method will be removed from the p…
Browse files Browse the repository at this point in the history
…ublic API in the future" (#6494)
  • Loading branch information
eaba authored Mar 7, 2023
1 parent d34b1e3 commit 1c3fee8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/Akka.TestKit/Internal/BlockingQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public bool TryPeek(out T item)
if(_collection.TryTake(out var p))
{
item = p.Value;
#pragma warning disable CS0618
AddFirst(item);
#pragma warning restore CS0618
return true;
}
item = default;
Expand All @@ -119,7 +121,9 @@ public bool TryPeek(out T item)
if(_collection.TryTake(out var p))
{
var item = p.Value;
#pragma warning disable CS0618
AddFirst(item);
#pragma warning restore CS0618
return (true, item);
}
return (false, default);
Expand All @@ -130,7 +134,9 @@ public bool TryPeek(out T item, int millisecondsTimeout, CancellationToken cance
if(_collection.TryTake(out var p, millisecondsTimeout, cancellationToken))
{
item = p.Value;
#pragma warning disable CS0618
AddFirst(item);
#pragma warning restore CS0618
return true;
}
item = default;
Expand All @@ -142,7 +148,9 @@ public bool TryPeek(out T item, int millisecondsTimeout, CancellationToken cance
if(_collection.TryTake(out var p, millisecondsTimeout, cancellationToken))
{
var item = p.Value;
#pragma warning disable CS0618
AddFirst(item);
#pragma warning restore CS0618
return (true, item);
}
return (false, default);
Expand All @@ -151,14 +159,18 @@ public bool TryPeek(out T item, int millisecondsTimeout, CancellationToken cance
public T Peek(CancellationToken cancellationToken)
{
var p = _collection.Take(cancellationToken);
#pragma warning disable CS0618
AddFirst(p.Value);
#pragma warning restore CS0618
return p.Value;
}

public async ValueTask<T> PeekAsync(CancellationToken cancellationToken)
{
var val = _collection.Take(cancellationToken).Value;
#pragma warning disable CS0618
AddFirst(val);
#pragma warning restore CS0618
return val;
}
#endregion
Expand Down

0 comments on commit 1c3fee8

Please sign in to comment.