Send notifications to queued clients
#include <sys/iofunc.h> void iofunc_notify_trigger( iofunc_notify_t *nop, int count, int index ); void iofunc_notify_trigger_strict( resmgr_context_t *ctp, iofunc_notify_t *nop, int count, int index);
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The iofunc_notify_trigger() function examines all entries given in the list maintained at nop [index] to see if the event should be delivered to the client. If the specified count is greater than or equal to the trigger count for the particular notification list element, this function calls MsgDeliverEvent() to deliver the event to the client whose rcvid is stored in the notification list element, and the list element is disarmed.
The iofunc_notify_trigger_strict() function is similar, except that only notifications armed via the file descriptor in the client that maps to the ctp argument are notified. The “strict” variant is useful when a duplicated file descriptor is closed, and only clients blocked on that fd are required to wake up and notice (EBADF on subsequent read or write). Calling this function with a ctp of NULL provides the same behavior as iofunc_notify_trigger().
A resource manager generally calls iofunc_notify_trigger_strict() in a close_dup callout to unblock any client select() calls that are waiting on a file descriptor that's been closed. You should call it three times with a count value of INT_MAX, the ctp passed to the close_dup callout, and an index of IOFUNC_NOTIFY_INPUT, IOFUNC_NOTIFY_OUTPUT, and IOFUNC_NOTIFY_OBAND.
Note that if the client has specified a code of SI_NOTIFY, then the value that the client specified (e.g. the value member of the struct sigevent) has the top three bits ORed with the reason for the trigger (this is the expression _NOTIFY_COND_INPUT << index), as in the following table:
If the client has specified a code of something other than SI_NOTIFY then this routine doesn't modify the value member in any way.
The sys/iofunc.h file also defines the IOFUNC_NOTIFY_INPUT_CHECK(), IOFUNC_NOTIFY_OUTPUT_CHECK(), and IOFUNC_NOTIFY_OBAND_CHECK() macros, which you can use to see if there are enough bytes in the lists to make it worthwhile to call iofunc_notify_trigger() to notify clients about:
#define IOFUNC_NOTIFY_INPUT_CHECK(__nop, __cnt, __tran) ... #define IOFUNC_NOTIFY_OUTPUT_CHECK(__nop, __cnt) ... #define IOFUNC_NOTIFY_OBAND_CHECK(__nop, __cnt, __tran) ...
The arguments are:
See Writing a Resource Manager
|Thread||Read the Caveats|
To ensure thread safety, lock the underlying object before calling this function. This object is usually an iofunc_attr_t structure; lock it by calling iofunc_attr_lock().
iofunc_notify(), iofunc_notify_remove(), sigevent
“Handling ionotify() and select()” in the Handling Other Messages chapter of Writing a Resource Manager
Resource Managers chapter of Getting Started with QNX Neutrino