interrupt_queueCreateLocked¶
Synopsis¶
#include <sys/interrupt.h>
int interrupt_queueCreateLocked(handle_t *queue, int clock);
Status¶
Implemented
Conformance¶
Phoenix-RTOS specific
Description¶
The interrupt_queueCreateLocked() function shall create an interrupt queue referenced by queue. In contrast to
interrupt_queueCreate(), the queue is a regular conditional variable created with
the PH_COND_NORMAL attribute (see condCreateWithAttr()) and therefore
has to be waited on with a mutex held, using
interrupt_queueWaitLocked().
This variant must be used whenever more than one thread may wait on the same interrupt, or when the predicate checked after the wake-up is shared with other threads and needs to be protected by a mutex.
The handle returned in queue is meant to be passed as the queue argument of the interrupt() syscall (see
Handling interrupts).
The clock argument selects the clock used to interpret the timeout argument of
interrupt_queueWaitLocked(). The following values are supported:
PH_CLOCK_RELATIVE-timeoutis relative to the current time,PH_CLOCK_REALTIME-timeoutis an absolute time based on the real-time clock,PH_CLOCK_MONOTONIC-timeoutis an absolute time based on the monotonic clock.
The queue shall be released with resourceDestroy().
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_queueCreateLocked() function shall fail if:
-ENOMEM- Insufficient memory exists to initialize the queue,-EINVAL- The value ofclockis invalid,-EFAULT- The address specified byqueueis invalid.