tibrvDispatcher_Create()

Function

Declaration

tibrv_status tibrvDispatcher_Create(
  tibrvDispatcher*  dispatcher,
  tibrvDispatchable dispatchable);
tibrv_status tibrvDispatcher_CreateEx(
  tibrvDispatcher*  dispatcher,
  tibrvDispatchable dispatchable,
  tibrv_f64         idleTimeout);

Purpose

Create a dispatcher thread.

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 TIBRV_WAIT_FOREVER instructs the dispatcher to loop indefinitely; the thread does not exit until the program explicitly destroys it.

The special value TIBRV_NO_WAIT instructs the dispatcher to poll until no events are ready to dispatch, then exit.

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

tibrvQueue_TimedDispatch()

tibrvQueueGroup_TimedDispatch()

tibrvDispatchable

tibrvDispatcher_Destroy()

tibrvDispatcher_SetName()

DISPATCHER.THREAD_EXITED in TIBCO Rendezvous Concepts