InterruptWait(), InterruptWait_r()

QNX SDP8.0C Library ReferenceAPIDeveloper

Wait for a hardware interrupt

Synopsis:

#include <sys/neutrino.h>

int InterruptWait( int flags,
                   const uint64_t * timeout );

int InterruptWait_r( int flags,
                     const uint64_t * timeout );

Arguments:

flags
A bitwise OR of zero or more of the following values:
  • _NTO_INTR_WAIT_FLAGS_FAST
  • _NTO_INTR_WAIT_FLAGS_UNMASK

For more information, see Flags, below.

timeout
This should currently be NULL. This may change in future versions.
Note: Use TimerTimeout() to achieve a timeout.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The InterruptWait() or InterruptWait_r() kernel calls wait for a hardware interrupt. These calls block while waiting for an interrupt to occur. For more information, see Blocking states below.

The InterruptWait() and InterruptWait_r() functions are identical except in the way they indicate errors. See the Returns section for details.

On a multicore system, a thread that calls InterruptWait() runs on any CPU, limited only by the scheduler and the runmask.

Flags

The flags argument is a bitwise OR of zero or more of the following values:

_NTO_INTR_WAIT_FLAGS_FAST
Use a lightweight blocking mechanism when waiting for an interrupt. Timeouts aren't supported if you use this flag.
Note: This flag is only valid from an IST that called InterruptAttachThread().
_NTO_INTR_WAIT_FLAGS_UNMASK
Unmask the interrupt before waiting. You won't need to call InterruptUnmask().

Blocking states

STATE_INTR
If the calling thread called InterruptAttachThread() and became an IST, the kernel blocks the IST on its interrupt semaphore while waiting for an interrupt to occur.
If the calling thread called InterruptAttachEvent() or InterruptAttachEventPriority() to create an IST, the thread blocks waiting for the IST to notify it with a type SIGEV_INTR event (i.e., a hardware interrupt) when an interrupt occurs.

Returns:

The only difference between these functions is the way they indicate errors:

InterruptWait()
If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
InterruptWait_r()
EOK is returned on success. This function does NOT set errno. If an error occurs, any value in the Errors section may be returned.

Errors:

EINTR
The call was interrupted by a signal.
ENOTSUP
The reserved arguments aren't NULL.
ETIMEDOUT
A kernel timeout unblocked the call. See TimerTimeout().

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: