Inherits IDisposable.
Public Member Functions | |
BufferPool (int numBuffers, int bufferSize, int frontPadding=0) | |
PoolBuffer | GetFreeBuffer () |
void | Dispose () |
Public Attributes | |
int | usedBufferCount = 0 |
object | disposeLock = new object() |
Semaphore | usedBufferLock |
This is how GetFreeBuffers() waits for a buffer to be free More... | |
Properties | |
int | totalBuffers [get] |
NobleConnect.BufferPool.BufferPool | ( | int | numBuffers, |
int | bufferSize, | ||
int | frontPadding = 0 |
||
) |
void NobleConnect.BufferPool.Dispose | ( | ) |
PoolBuffer NobleConnect.BufferPool.GetFreeBuffer | ( | ) |
object NobleConnect.BufferPool.disposeLock = new object() |
int NobleConnect.BufferPool.usedBufferCount = 0 |
Semaphore NobleConnect.BufferPool.usedBufferLock |
This is how GetFreeBuffers() waits for a buffer to be free
There are numBuffers unlocked locks initially, representing the unused buffers. GetGreeBuffers() tries to get an unlocked lock. If there are none available, WaitOne() will wait for one. Getting the lock automatically locks it. Freeing a buffer unlocks a lock.
|
get |