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