FreeRDP
|
#include <winpr/config.h>
#include <winpr/crt.h>
#include <winpr/assert.h>
#include <winpr/collections.h>
Functions | |
size_t | Queue_Count (wQueue *queue) |
Return the number of elements in the queue. More... | |
void | Queue_Lock (wQueue *queue) |
Mutex-Lock a queue. More... | |
void | Queue_Unlock (wQueue *queue) |
Mutex-Unlock a queue. More... | |
HANDLE | Queue_Event (wQueue *queue) |
Get an event handle for the queue, usable by WaitForSingleObject or WaitForMultipleObjects. More... | |
wObject * | Queue_Object (wQueue *queue) |
Mutex-Lock a queue. More... | |
void | Queue_Clear (wQueue *queue) |
Remove all elements from a queue, call wObject cleanup functions fnObjectFree. More... | |
BOOL | Queue_Contains (wQueue *queue, const void *obj) |
Check if the queue contains an object. More... | |
static BOOL | Queue_EnsureCapacity (wQueue *queue, size_t count) |
BOOL | Queue_Enqueue (wQueue *queue, const void *obj) |
Pushes a new element into the queue. If a fnObjectNew is set, the element is copied and the queue takes ownership of the memory, otherwise the ownership stays with the caller. More... | |
void * | Queue_Dequeue (wQueue *queue) |
returns the element at the top of the queue. The element is removed from the queue, ownership of the element is passed on to the caller. More... | |
void * | Queue_Peek (wQueue *queue) |
returns the element at the top of the queue. The element is not removed from the queue, ownership of the element stays with the queue. More... | |
void | Queue_Discard (wQueue *queue) |
Removes the element at the top of the queue. If fnObjectFree is set, the element is freed. This can be used in combination with Queue_Peek to handle an element and discard it with this function afterward. An alternative is Queue_Dequeue with calling the appropriate free function afterward. More... | |
static BOOL | default_queue_equals (const void *obj1, const void *obj2) |
wQueue * | Queue_New (BOOL synchronized, SSIZE_T capacity, SSIZE_T growthFactor) |
Creates a new queue. More... | |
void | Queue_Free (wQueue *queue) |
Clean up a queue, free all resources (e.g. calls Queue_Clear) More... | |
|
static |
void Queue_Clear | ( | wQueue * | queue | ) |
Remove all elements from a queue, call wObject cleanup functions fnObjectFree.
Methods Removes all objects from the Queue.
BOOL Queue_Contains | ( | wQueue * | queue, |
const void * | obj | ||
) |
Check if the queue contains an object.
Determines whether an element is in the Queue.
size_t Queue_Count | ( | wQueue * | queue | ) |
Return the number of elements in the queue.
C equivalent of the C# Queue Class: http://msdn.microsoft.com/en-us/library/system.collections.queue.aspx Properties Gets the number of elements contained in the Queue.
void* Queue_Dequeue | ( | wQueue * | queue | ) |
returns the element at the top of the queue. The element is removed from the queue, ownership of the element is passed on to the caller.
Removes and returns the object at the beginning of the Queue.
void Queue_Discard | ( | wQueue * | queue | ) |
Removes the element at the top of the queue. If fnObjectFree is set, the element is freed. This can be used in combination with Queue_Peek to handle an element and discard it with this function afterward. An alternative is Queue_Dequeue with calling the appropriate free function afterward.
queue | The queue to operate on |
BOOL Queue_Enqueue | ( | wQueue * | queue, |
const void * | obj | ||
) |
Pushes a new element into the queue. If a fnObjectNew is set, the element is copied and the queue takes ownership of the memory, otherwise the ownership stays with the caller.
Adds an object to the end of the Queue.
|
static |
HANDLE Queue_Event | ( | wQueue * | queue | ) |
Get an event handle for the queue, usable by WaitForSingleObject or WaitForMultipleObjects.
Gets an event which is set when the queue is non-empty
void Queue_Free | ( | wQueue * | queue | ) |
Clean up a queue, free all resources (e.g. calls Queue_Clear)
queue | The queue to free, may be NULL |
void Queue_Lock | ( | wQueue * | queue | ) |
Mutex-Lock a queue.
Lock access to the ArrayList
wQueue* Queue_New | ( | BOOL | synchronized, |
SSIZE_T | capacity, | ||
SSIZE_T | growthFactor | ||
) |
Creates a new queue.
Construction, Destruction
wObject* Queue_Object | ( | wQueue * | queue | ) |
Mutex-Lock a queue.
queue | A pointer to a queue, must not be NULL |
void* Queue_Peek | ( | wQueue * | queue | ) |
returns the element at the top of the queue. The element is not removed from the queue, ownership of the element stays with the queue.
Returns the object at the beginning of the Queue without removing it.
void Queue_Unlock | ( | wQueue * | queue | ) |
Mutex-Unlock a queue.
Unlock access to the ArrayList