NAME ^

src/tsq.c - Thread-safe queues

DESCRIPTION ^

Functions ^

PARROT_CAN_RETURN_NULL QUEUE_ENTRY *pop_entry(NOTNULL(QUEUE *queue))

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

PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT QUEUE_ENTRY *peek_entry(NOTNULL(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.

PARROT_CAN_RETURN_NULL QUEUE_ENTRY *nosync_pop_entry(NOTNULL(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.

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

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

void unshift_entry(NOTNULL(QUEUE *queue), NOTNULL(QUEUE_ENTRY *entry))

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

void nosync_insert_entry(NOTNULL(QUEUE *queue), NOTNULL(QUEUE_ENTRY *entry))

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

void insert_entry(NOTNULL(QUEUE *queue), NOTNULL(QUEUE_ENTRY *entry))

Does a synchronized insert of entry.

void queue_lock(NOTNULL(QUEUE *queue))

Locks the queue's mutex.

void queue_unlock(NOTNULL(QUEUE *queue))

Unlocks the queue's mutex.

void queue_broadcast(NOTNULL(QUEUE *queue))

This function wakes up every thread waiting on the queue.

void queue_signal(NOTNULL(QUEUE *queue))

XXX Needs a description

void queue_wait(NOTNULL(QUEUE *queue))

Instructs the queue to wait.

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

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

PARROT_CAN_RETURN_NULL PARROT_MALLOC QUEUE *queue_init(UINTVAL prio)

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

void queue_destroy(NOTNULL(QUEUE *queue))

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

SEE ALSO ^

include/parrot/tsq.h.


parrot