TibrvDispatcher::create()

Method

Declaration

TibrvStatus create(
    TibrvDispatchable* dispatchable,
    tibrv_f64 idleTimeout = TIBRV_WAIT_FOREVER);

Purpose

Start a dispatcher thread.

Remarks

This method creates a C dispatcher thread and stores its handle in the C++ object.

A dispatcher thread repeatedly dispatches a queue or queue group.

Inside the thread, a loop calls TibrvDispatchable::timedDispatch(). 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

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

TibrvDispatchable::timedDispatch()

TibrvDispatchable

TibrvDispatcher::destroy()

TibrvDispatcher::setName()

DISPATCHER.THREAD_EXITED in TIBCO Rendezvous Concepts

tibrvDispatcher in TIBCO Rendezvous C Reference