|
FreeRDP
|

Data Structures | |
| struct | TPCircularBuffer |
Functions | |
| bool | TPCircularBufferInit (TPCircularBuffer *buffer, int32_t length) |
| void | TPCircularBufferCleanup (TPCircularBuffer *buffer) |
| void | TPCircularBufferClear (TPCircularBuffer *buffer) |
| static __inline__ | __attribute__ ((always_inline)) void *TPCircularBufferTail(TPCircularBuffer *buffer |
| return (void *)((char *) buffer -> buffer+buffer->tail) | |
| OSAtomicAdd32Barrier (-amount, &buffer->fillCount) | |
| WINPR_ASSERT (buffer->fillCount >=0) | |
| OSAtomicAdd32Barrier (amount, &buffer->fillCount) | |
| WINPR_ASSERT (buffer->fillCount<=buffer->length) | |
| if (space< len) return false | |
| memcpy (ptr, src, len) | |
| TPCircularBufferProduce (buffer, len) | |
Variables | |
| static __inline__ int32_t * | availableBytes |
| if availableBytes return | NULL |
| static __inline__ int32_t | amount |
| buffer | fillCount = amount |
| static __inline__ const void * | src |
| static __inline__ const void int32_t | len |
| void * | ptr = TPCircularBufferHead(buffer, &space) |
| return | true |
|
static |
Access end of buffer
This gives you a pointer to the end of the buffer, ready for reading, and the number of available bytes to read.
| buffer | Circular buffer |
| availableBytes | On output, the number of bytes ready for reading |
Consume bytes in buffer
This frees up the just-read bytes, ready for writing again.
| buffer | Circular buffer |
| amount | Number of bytes to consume |
Version of TPCircularBufferConsume without the memory barrier, for more optimal use in single-threaded contexts
Access front of buffer
This gives you a pointer to the front of the buffer, ready for writing, and the number of available bytes to write.
| buffer | Circular buffer |
| availableBytes | On output, the number of bytes ready for writing |
Produce bytes in buffer
This marks the given section of the buffer ready for reading.
| buffer | Circular buffer |
| amount | Number of bytes to produce |
Version of TPCircularBufferProduce without the memory barrier, for more optimal use in single-threaded contexts
Helper routine to copy bytes to buffer
This copies the given bytes to the buffer, and marks them ready for writing.
| buffer | Circular buffer |
| src | Source buffer |
| len | Number of bytes in source buffer |
| if | ( | ) |
| OSAtomicAdd32Barrier | ( | - | amount, |
| &buffer-> | fillCount | ||
| ) |
| OSAtomicAdd32Barrier | ( | amount | , |
| &buffer-> | fillCount | ||
| ) |
| return | ( | void * | ) | -> buffer+buffer->tail) |
| void TPCircularBufferCleanup | ( | TPCircularBuffer * | buffer | ) |
Cleanup buffer
Releases buffer resources.

| void TPCircularBufferClear | ( | TPCircularBuffer * | buffer | ) |
Clear buffer
Resets buffer to original, empty state.
This is safe for use by consumer while producer is accessing buffer.

| bool TPCircularBufferInit | ( | TPCircularBuffer * | buffer, |
| int32_t | length | ||
| ) |
Initialise buffer
Note that the length is advisory only: Because of the way the memory mirroring technique works, the true buffer length will be multiples of the device page size (e.g. 4096 bytes)
| buffer | Circular buffer |
| length | Length of buffer |
| TPCircularBufferProduce | ( | buffer | , |
| len | |||
| ) |
| WINPR_ASSERT | ( | buffer->fillCount >= | 0 | ) |
| WINPR_ASSERT | ( | buffer->fillCount<=buffer-> | length | ) |
| static __inline__ int amount |
| static __inline__ int32_t * availableBytes |
| buffer fillCount = amount |
| __inline__ const void int32_t len |
| if availableBytes return NULL |
| void* ptr = TPCircularBufferHead(buffer, &space) |
| __inline__ const void* src |
| return true |