QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
What do "thread interrupt" and "signal safe" mean? |
Ref. No. |
QNX.000009436 |
Category(ies) |
Development |
Issue |
In the QNX4 Watcom 10.6 documentation, functions are listed as being thread, signal, and interrupt safe or not. What do these mean? Why would a function not be safe in these areas?
|
Solution |
Thread safe means the function can be called from multiple threads without destructive results. If a function uses global data, then another occurance of it running in a second thread will easily corrupt that global data, and crash both functions or at least return bad data. This is an example of a function that is not thread safe.
Signal safe means the function doesn't use any global data structures that could be corrupted during a signal.
Interrupt safe: There are limited things you can do in an interrupt handler. For example in an interrupt handler there is no floating point support. Also, there are time constraints in an interrupt handler. If an interrupt handler takes too long to return, it can cause a buildup of pending interrupts. This is a common cause of a Proc fault that ends up pointing to an interrupt handler error.
|
|