Allocate a dispatch handle, specifying a channel ID


#include <sys/iofunc.h>
#include <sys/dispatch.h>

dispatch_t *dispatch_create_channel( int chid,
                                     unsigned reserved );


The ID of the channel to use for the dispatch layer.
Reserved; specify 0 for this argument.



Use the -l c option to qcc to link against this library. This library is usually included automatically.


The dispatch_create_channel() function allocates and initializes a dispatch handle. After you've called this function, you need to call one or more of the following functions to attach handlers for the things you want the dispatch layer to deal with:

Then you call dispatch_context_alloc() to allocate the context for dispatch_block() and dispatch_handler().

Note: Once you've called dispatch_context_alloc(), don't call message_attach() or resmgr_attach() specifying a different maximum message size or a different number of message parts for the same dispatch handle.

If you wish, you can do a resmgr_attach() with a NULL path. This has the effect of initializing dispatch to receive messages, among other things.

This function is similar to dispatch_create(), but lets you specify a channel for the dispatch to use. It also lets you specify channel flags for name_attach().

Note: In order to create a public channel (i.e., without _NTO_CHF_PRIVATE set), your process must have the PROCMGR_AID_PUBLIC_CHANNEL ability enabled. For more information, see procmgr_ability().

This function is part of the dispatch layer of a resource manager. For more information, see "Layers in a resource manager" in the Bones of a Resource Manager chapter of Writing a Resource Manager.


A handle to a dispatch structure, or NULL if an error occurs. The dispatch_t structure is an opaque data type; you can't access its contents directly.


Insufficient memory to allocate context.


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes