InterruptDetach(), InterruptDetach_r()

QNX SDP8.0C Library ReferenceAPIDeveloper

Detach an interrupt thread by ID

Synopsis:

#include <sys/neutrino.h>

int InterruptDetach( int id );

int InterruptDetach_r( int id );

Arguments:

id
An interrupt ID, as returned by InterruptAttachThread(), InterruptAttachEvent(), or InterruptAttachEventPriority().

Library:

libc

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

Description:

The InterruptDetach() and InterruptDetach_r() kernel calls detach the interrupt thread specified by the id argument. These functions are identical except in the way they indicate errors. See the Returns section for details.

When a thread calls either InterruptAttachThread() or InterruptAttachEvent*() using the event type SIGEV_INTR, it becomes an IST (Interrupt Service Thread). In this case, only the IST itself is allowed to call InterruptDetach(). Such an IST may call InterruptDetach() to detach itself from the interrupt, at which point it ceases to be an IST.

However, when InterruptAttachEvent*() is used with any event type other than SIGEV_INTR, it sets up an in-kernel IST for the interrupt which will deliver the events. In this case, any thread within the process may call InterruptDetach(). This call dissociates the event handling from the interrupt and causes the in-kernel IST, which was handling the interrupt, to terminate.

Blocking states

These calls don't block.

Returns:

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

InterruptDetach()
If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
InterruptDetach_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:

EINVAL
One of the following:
  • The value of id doesn't exist.
  • The id specifies a user-space IST but it is not that IST calling InterruptDetach().

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: