This repository was archived by the owner on Dec 18, 2018. It is now read-only.
File tree 1 file changed +4
-4
lines changed
src/Microsoft.AspNet.Server.Kestrel/Infrastructure 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public class MemoryPool2 : IDisposable
46
46
/// Thread-safe collection of blocks which are currently in the pool. A slab will pre-allocate all of the block tracking objects
47
47
/// and add them to this collection. When memory is requested it is taken from here first, and when it is returned it is re-added.
48
48
/// </summary>
49
- private readonly ConcurrentStack < MemoryPoolBlock2 > _blocks = new ConcurrentStack < MemoryPoolBlock2 > ( ) ;
49
+ private readonly ConcurrentQueue < MemoryPoolBlock2 > _blocks = new ConcurrentQueue < MemoryPoolBlock2 > ( ) ;
50
50
51
51
/// <summary>
52
52
/// Thread-safe collection of slabs which have been allocated by this pool. As long as a slab is in this collection and slab.IsActive,
@@ -88,7 +88,7 @@ public MemoryPoolBlock2 Lease(int minimumSize = MaxPooledBlockLength)
88
88
}
89
89
90
90
MemoryPoolBlock2 block ;
91
- if ( _blocks . TryPop ( out block ) )
91
+ if ( _blocks . TryDequeue ( out block ) )
92
92
{
93
93
// block successfully taken from the stack - return it
94
94
return block ;
@@ -145,7 +145,7 @@ private MemoryPoolBlock2 AllocateSlab()
145
145
public void Return ( MemoryPoolBlock2 block )
146
146
{
147
147
block . Reset ( ) ;
148
- _blocks . Push ( block ) ;
148
+ _blocks . Enqueue ( block ) ;
149
149
}
150
150
151
151
protected virtual void Dispose ( bool disposing )
@@ -158,7 +158,7 @@ protected virtual void Dispose(bool disposing)
158
158
}
159
159
160
160
MemoryPoolBlock2 block ;
161
- while ( _blocks . TryPop ( out block ) )
161
+ while ( _blocks . TryDequeue ( out block ) )
162
162
{
163
163
// Deactivate finalizers
164
164
block . Dispose ( ) ;
You can’t perform that action at this time.
0 commit comments