interrupt_queueWaitLocked

Synopsis

#include <sys/interrupt.h>

int interrupt_queueWaitLocked(handle_t queue, handle_t lock, time_t timeout);

Status

Implemented

Conformance

Phoenix-RTOS specific

Description

The interrupt_queueWaitLocked() function shall block the calling thread on the interrupt queue queue, previously created with interrupt_queueCreateLocked(), until the queue is signaled by the kernel after the interrupt handler returns a value greater than or equal to zero, or until timeout expires.

The application shall ensure that the mutex lock is locked by the calling thread. The mutex is atomically released while the thread is blocked and re-acquired before the function returns. This is the variant that must be used when more than one thread waits for the same interrupt, or when the predicate checked after the wake-up is shared with other threads.

The function is equivalent to calling condWait() on the queue handle.

The timeout argument is interpreted according to the clock selected when the queue was created. A timeout of zero waits indefinitely. Spurious wake-ups may occur, so the condition the thread is waiting for should be re-evaluated after return.

Return value

Upon successful completion, a value of zero shall be returned; otherwise, an error number shall be returned to indicate the error.

Errors

The interrupt_queueWaitLocked() function shall fail if:

  • -EINVAL - The value queue does not refer to a valid interrupt queue, or lock does not refer to an initialized mutex,

  • -ETIME - The queue was not signaled before the specified timeout expired.