src/tsq.c - Thread-safe queues


Functions ^

QUEUE_ENTRY *pop_entry

Does a synchronized removal of the head entry off the queue and returns it.

QUEUE_ENTRY *peek_entry

This does no locking, so the result might have changed by the time you get the entry, but a synchronized pop_entry() will check again and return NULL if the queue is empty.

QUEUE_ENTRY *nosync_pop_entry

Grab an entry off the queue with no synchronization. Internal only, because it's darned evil and shouldn't be used outside the module. It's in here so we don't have to duplicate pop code.

QUEUE_ENTRY *wait_for_entry

Does a synchronized removal of the head entry off the queue, waiting if necessary until there is an entry, and then returns it.

void push_entry

Does a synchronized insertion of entry onto the tail of the queue.

void unshift_entry

Does a synchronized insertion of entry into the head of the queue.

void nosync_insert_entry

Inserts a timed event according to abstime. The caller has to hold the queue mutex.

void insert_entry

Does a synchronized insert of entry.

void queue_lock

Locks the queue's mutex.

void queue_unlock

Unlocks the queue's mutex.

void queue_broadcast

This function wakes up every thread waiting on the queue.

void queue_signal

XXX Needs a description

void queue_wait

Instructs the queue to wait.

void queue_timedwait

Instructs the queue to wait for abs_time seconds (?).

QUEUE *queue_init

Initializes the queue, setting prio as the queue's priority.

void queue_destroy

Destroys the queue, raising an exception if it is not empty.