tibrvQueueHook
Function Type
Declaration
typedef void (*tibrvQueueHook) (
tibrvQueue eventQueue,
void* closure);
Purpose
Asynchronously notify an external event manager when a Rendezvous event is ready for dispatch.
Motivation
Some programs need to use existing event managers to dispatch Rendezvous events. Some event managers repeatedly poll queues for events; others require notification that an event is ready (for example, the Microsoft Windows event manager operates this way). This hook function can inform an event manager when an event enters a queue and is ready for dispatch.
You can think of this function as a wake-up call to the event manager. Once awakened, the event manager dispatches Rendezvous events in its usual way, by calling tibrvQueue_Dispatch() or tibrvQueue_TimedDispatch().
Remarks
When coding hook functions, remember that hook functions can be called from any thread. In general, hook functions run in the thread that enqueues the event; that thread can be a program thread, or a Rendezvous internal thread.
Procedure
To use this facility, follow these steps:
Procedure
| 1. | Code a queue hook function to post a message to the target event manager when a message is received. |
| 2. | Arrange for the target event handler to call tibrvQueue_Dispatch(). |
| 3. | Register the queue hook function, using tibrvQueue_SetHook(). |
|
Parameter |
Description |
|
|
This parameter receives the queue on which an event has arrived. |
|
|
This parameter receives closure data supplied by the program when it registered this hook function. |