MyQttAsyncQueue * myqtt_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 myqtt_async_queue_ref. If the reference count reaches zero value, the queue is deallocated.

A particular useful function is myqtt_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 myqtt_async_queue_unref. Note reference returned must be checked to be not NULL (caused by memory allocation error).

References MYQTT_CHECK_REF, MYQTT_CHECK_REF2, myqtt_cond_create(), and myqtt_mutex_create().

Referenced by myqtt_conn_get_next(), myqtt_conn_ping(), myqtt_hash_lock_until_changed(), myqtt_listener_wait(), myqtt_thread_pool_init(), myqttd_ctx_new(), myqttd_loop_create(), and myqttd_loop_unwatch_descriptor().