Implement tryadd, adding itmes with a timeout
This commit is contained in:
@@ -166,11 +166,19 @@ int uc_thread_queue_init(struct uc_threadqueue *queue, long max_elements);
|
||||
* the front of the queue, i.e. it can be considered a "priority" message.
|
||||
*
|
||||
* @param queue Pointer to the queue on where the message should be added.
|
||||
* @param timeout timeout on how long to wait on a message, or NULL for no timeout
|
||||
* @param data the "message".
|
||||
* @return 0 on succes ENOMEM if out of memory EINVAL if queue is NULL, or other
|
||||
* @return 0 on succes ENOMEM if out of memory EINVAL if queue is NULL, ETIMEDOUT if timeout occured or other
|
||||
* errno values if pthread functions failed.
|
||||
*/
|
||||
int uc_thread_queue_add(struct uc_threadqueue *queue, struct uc_threadmsg *msg);
|
||||
int uc_thread_queue_tryadd(struct uc_threadqueue *queue, const struct timespec *timeout, struct uc_threadmsg *msg);
|
||||
|
||||
/**
|
||||
* Like uc_thread_queue_add but will wait indefintly.
|
||||
* @see uc_thread_queue_add
|
||||
*/
|
||||
#define uc_thread_queue_add(queue, msg)\
|
||||
uc_thread_queue_tryadd(queue, NULL, msg)
|
||||
|
||||
/**
|
||||
* Gets a message from a queue
|
||||
|
||||
Reference in New Issue
Block a user