Thread Queue Interface


This interface provides asynchronous thread queues that can be used to pass messages and data between two or more threads. Typically a thread would create the queue, push data into the queue and some other thread takes the data from the queue or blocks until more data is available in the queue.

The queue itself can have one ore more pipes, allowing user to use one queue to pass different information in different pipes, if each pipe need to be dedicated to specific type of data.


 Thread 1:

 // Create queue and push data into it
 SilcThreadQueue queue = silc_thread_queue_alloc(1, FALSE);
 silc_thread_queue_push(queue, 0, data, FALSE);

 Thread 2:

 // Connect to the queue

 // Block here until data is available from the queue
 data = silc_thread_queue_pop(queue, 0, TRUE);