[Previous]

[Contents]

[Next]


evt_create_channel()

Create and Attach to an event channel.

Synopsis:

#include <evt.h>
#include <lib_evt.h>
 
int evt_create_channel(const evt_cnx_t *evtcnx, int id, int maxnb_evt_pending, void **channel_handle );

Description:

The evt_create_channel() function enable a task (process or thread) to attach to an event channel for further signaling over this channel. This function is called by the task which want to be signaled by another task, and should be used with evt_fetch_event and/or evt_fetch_events.

The evt_create_channel function needs the following parameters:

evtcnx

Opaque structure pointer as returned by the initial call to evt_open()

id

Unique identifier for the created channel. Any number (32-bits) can be used, as long it is unique. This number will be used by the task(s) doing the signaling (call to evt_locate _channel + call(s) to evt_post_event).

maxnb_evt_pending

This is the maximum number of events that can be queued by the driver. When this number of events are in the queue, the next call to evt_post_event (signaling) will exit with the error ENFILE (but only after the specified timeout occurs).

channel_handle

Return an handle which will be used to reference this particular channel in the next call to the functions evt_delete_channel, evt_fetch_event and/or evt_fetch_events.

Note that evt_create_channel is called by the task which want to be later signaled.


Note:

Only one task at a time can attach to a given event channel.


Returns:

0 is the operation succeeds, or -1 if an error occurred (errno is then set).

Example:

See this simple example.

Errors:

EFAULT

Memory Exception.

ENFILE

Overflow into the table of attached tasks (process of thread). The current limit is set to 512.

EEXIST

Already a channel with the given ID.

See also:

evt_open(), evt_delete_channel(), evt_locate_channel()


[Previous]

[Contents]

[Next]