S2OPC OPCUA Toolkit
|
An asynchronous and thread-safe queue implementation. More...
#include "sopc_enums.h"
Go to the source code of this file.
Typedefs | |
typedef struct SOPC_AsyncQueue | SOPC_AsyncQueue |
Functions | |
SOPC_ReturnStatus | SOPC_AsyncQueue_Init (SOPC_AsyncQueue **queue, const char *queueName) |
Initialize the queue, the queue must be freed at the end of it's use with SOPC_AsyncQueue_Free. | |
SOPC_ReturnStatus | SOPC_AsyncQueue_BlockingEnqueue (SOPC_AsyncQueue *queue, void *element) |
Add a new element (and allocate new queue element) to the head of the given linked queue. Can be used as FIFO queue with SOPC_AsyncQueue_BlokingDequeue or SOPC_AsyncQueue_NonBlockingDequeue. | |
SOPC_ReturnStatus | SOPC_AsyncQueue_BlockingEnqueueFirstOut (SOPC_AsyncQueue *queue, void *element) |
Add a new element (and allocate new queue element) to the tail of the given linked queue. Can be used as LIFO queue with SOPC_AsyncQueue_BlokingDequeue or SOPC_AsyncQueue_NonBlockingDequeue. | |
SOPC_ReturnStatus | SOPC_AsyncQueue_BlockingDequeue (SOPC_AsyncQueue *queue, void **element) |
Get and remove the head element of the queue. If the queue is empty the function will block until an element is added in the queue. | |
SOPC_ReturnStatus | SOPC_AsyncQueue_NonBlockingDequeue (SOPC_AsyncQueue *queue, void **element) |
Get and remove the head element of the queue. If the queue is empty the function will block until an element is added in the queue. Element must be freed after used. | |
void | SOPC_AsyncQueue_Free (SOPC_AsyncQueue **queue) |
: clear the queue by freeing every present element and free the asynchronous queue | |
An asynchronous and thread-safe queue implementation.
typedef struct SOPC_AsyncQueue SOPC_AsyncQueue |
SOPC_ReturnStatus SOPC_AsyncQueue_Init | ( | SOPC_AsyncQueue ** | queue, |
const char * | queueName ) |
Initialize the queue, the queue must be freed at the end of it's use with SOPC_AsyncQueue_Free.
queue | Pointer on the address of the queue |
queueName | Pointer on a string, useful to debug |
SOPC_ReturnStatus SOPC_AsyncQueue_BlockingEnqueue | ( | SOPC_AsyncQueue * | queue, |
void * | element ) |
Add a new element (and allocate new queue element) to the head of the given linked queue. Can be used as FIFO queue with SOPC_AsyncQueue_BlokingDequeue or SOPC_AsyncQueue_NonBlockingDequeue.
queue | Pointer on the linked queue in which new element must be added |
element | Pointer to the element to append, must be dynamically created by user. |
SOPC_ReturnStatus SOPC_AsyncQueue_BlockingEnqueueFirstOut | ( | SOPC_AsyncQueue * | queue, |
void * | element ) |
Add a new element (and allocate new queue element) to the tail of the given linked queue. Can be used as LIFO queue with SOPC_AsyncQueue_BlokingDequeue or SOPC_AsyncQueue_NonBlockingDequeue.
queue | Pointer on the linked queue in which new element must be added |
element | Pointer to the element to append, must be dynamically created by user. |
SOPC_ReturnStatus SOPC_AsyncQueue_BlockingDequeue | ( | SOPC_AsyncQueue * | queue, |
void ** | element ) |
Get and remove the head element of the queue. If the queue is empty the function will block until an element is added in the queue.
queue | Pointer on the linked queue in which the element will be removed |
element | Pointer to the address of the element to remove. element can be freed by caller after use |
SOPC_ReturnStatus SOPC_AsyncQueue_NonBlockingDequeue | ( | SOPC_AsyncQueue * | queue, |
void ** | element ) |
Get and remove the head element of the queue. If the queue is empty the function will block until an element is added in the queue. Element must be freed after used.
queue | Pointer on the linked queue in which the element will be removed |
element | Pointer to the addres of the element to remove, element can be freed by caller after use |
void SOPC_AsyncQueue_Free | ( | SOPC_AsyncQueue ** | queue | ) |
: clear the queue by freeing every present element and free the asynchronous queue