InterruptUnblock(), InterruptUnblock_r()
QNX SDP8.0C Library ReferenceAPIDeveloper
Calls to the kernel to post a semaphore associated with an interrupt handler
Synopsis:
#include <sys/neutrino.h>
int InterruptUnblock(int id);
Arguments:
- interrupt handler id
- The id of the interrupt handler used in a call to InterruptUnblock().
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
InterruptUnblock() allows an Interrupt Service Thread (IST) to be made ready for a reason other than receiving an interrupt. For example, InterruptUnblock() may be used as a mechanism that ensures an IST can detach itself.
A process that uses an IST may require a thread to be detached from its interrupt. For example, if:
- The IST must exit cleanly while the process is still running.
- The IST must attach itself to a different interrupt source.
A typical implementation consists of the following steps:
- Set a global flag (so that the IST can distinguish between a hardware interrupt and an event from InterruptUnblock()).
- Memory barrier.
- Invoke the InterruptUnblock() kernel call.
Note:
You must implement a mechanism to distinguish between a hardware interrupt and a thread unblocking the IST. Setting a global flag
is given as an example of one method for implementing such a mechanism.
The IST is expected to check the flag every time the kernel call (to wait for an interrupt) returns. It can then detach itself from the interrupt.
Note:
The IST cannot distinguish between a real interrupt arriving, and the result of the kernel call to
post the handler. It is even possible for the two events to occur before the IST has a chance to run
in its user persona, following a call to wait on an interrupt.
Returns:
The only difference between these functions is the way they indicate errors:
- InterruptUnblock()
- If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
- InterruptUnblock_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.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |
Page updated: