NAME ^

src/tsq.c - Thread-safe queues

DESCRIPTION ^

Functions ^

QUEUE_ENTRY *pop_entry(QUEUE *queue)

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

QUEUE_ENTRY *peek_entry(QUEUE *queue)

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(QUEUE *queue)

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(QUEUE *queue)

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(QUEUE *queue, QUEUE_ENTRY *entry)

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

void unshift_entry(QUEUE *queue, QUEUE_ENTRY *entry)

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

void nosync_insert_entry(QUEUE *queue, QUEUE_ENTRY *entry)

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

void insert_entry(QUEUE *queue, QUEUE_ENTRY *entry)

Does a synchronized insert of entry.

void queue_lock(QUEUE *queue)

Locks the queue's mutex.

void queue_unlock(QUEUE *queue)

Unlocks the queue's mutex.

void queue_broadcast(QUEUE *queue)

This function wakes up every thread waiting on the queue.

void queue_signal(QUEUE *queue)

Description.

void queue_wait(QUEUE *queue)

Instructs the queue to wait.

void queue_timedwait(QUEUE *queue, struct timespec *abs_time)

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

QUEUE *queue_init(UINTVAL prio)

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

void queue_destroy(QUEUE *queue)

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

SEE ALSO ^

include/parrot/tsq.h.


parrot