ValvulaAsyncQueue * valvula_async_queue_new ( void  )

Creates a new async message queue, a inter thread communication that allows to communicate and synchronize data between threads inside the same process.

Once created, you can use the following function to push and retrieve data from the queue:

You can increase the reference counting by using valvula_async_queue_ref. If the reference count reaches zero value, the queue is deallocated.

A particular useful function is valvula_async_queue_length which returns the number of queue items minus waiting threads.

Returns
A newly created async queue, with a reference count equal to 1. To dealloc it when no longer needed, use valvula_async_queue_unref. Note reference returned must be checked to be not NULL (caused by memory allocation error).

References VALVULA_CHECK_REF, VALVULA_CHECK_REF2, valvula_cond_create(), and valvula_mutex_create().

Referenced by valvula_hash_lock_until_changed(), and valvula_thread_pool_init().