Skip to content

Commit 804642a

Browse files
author
Oren (electricessence)
committed
Added ConfigureAwait(false) where useful.
1 parent 0b8eb4e commit 804642a

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

source/ObjectPoolBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public Task GiveAsync(T item)
9393
async Task ReceiveConditionalAsync(T item)
9494
{
9595
if(PrepareToReceive(item)
96-
&& (SaveToPocket(item) || await ReceiveAsync(item)))
96+
&& (SaveToPocket(item) || await ReceiveAsync(item).ConfigureAwait(false))) // Doesn't need original context. Just needs to trigger OnReceived().
9797
OnReceived();
9898
}
9999
#endregion

source/Recycler.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public class Recycler<T> : DisposableBase
1212
where T : class
1313
{
1414
IObjectPool<T> _target;
15+
16+
// Something else could be used and could be more performant.
17+
// But it's an ideal interface for what's needed. And the point is that the recyler should not take up too much cpu time.
1518
ActionBlock<T> _bin;
1619

1720
public Recycler(

0 commit comments

Comments
 (0)