tibrvDispatcher_Create()
Function
Declaration
tibrv_statustibrvDispatcher_Create
(
tibrvDispatcher* dispatcher,
tibrvDispatchable dispatchable);
tibrv_statustibrvDispatcher_CreateEx
(
tibrvDispatcher* dispatcher,
tibrvDispatchable dispatchable,
tibrv_f64 idleTimeout);
Purpose
Remarks
A dispatcher thread repeatedly dispatches a queue or queue group.
Inside the thread, a loop calls tibrvQueue_TimedDispatch() or tibrvQueueGroup_TimedDispatch() (as appropriate to the dispatchable
argument).
The simple form of this function creates a dispatcher thread that loops indefinitely. The extended function creates a thread that passes the idleTimeout
argument to the timed dispatch call; if the timed dispatch call returns without dispatching an event (after waiting for idleTimeout
seconds), then the thread exits by calling tibrvDispatcher_Destroy().
Parameter |
Description |
dispatcher |
The program supplies a location, and the function stores the address of the new dispatcher thread in that location. |
dispatchable |
The new thread dispatches this object, which can be either a queue or a queue group. |
idleTimeout |
When this time period (in seconds) elapses without dispatching an event, the thread exits. The special value The special value |
Stack Size
On UNIX platforms that use the POSIX thread package (pthread
), this call sets the stacksize
attribute of the dispatcher thread to the larger of two candidate values—either the default stack size of the operating system, or 64 kilobytes.
For programs that require a larger stack size, we recommend that you code a custom dispatcher thread.
See Also
tibrvQueueGroup_TimedDispatch()
DISPATCHER.THREAD_EXITED in