int smd_ev_create(tSMEventId *eventId, tSMChannelId channelId, int eventType, int eventChannelBinding)
kSMEventTypeReadData
,
kSMEventTypeWriteData
, or
kSMEventTypeRecog
.
kSMChannelSpecificEvent
,
kSMChannelSpecificEventNonIdle
, or
kSMAnyChannelEvent
.
Creates an operating system event object suitable for use with
a specific channel indicated by
channelId
(the parameter
eventChannelBinding
must be set to kSMChannelSpecificEvent
in this
case) or, alternatively, creates an operating system event object for
collective use by all nominated channels (in which case
channelId
must be set to kSMNullChannelId
and
eventChannelBinding
to kSMAnyChannelEvent
).
An application which waits on a channel-specific event will be woken whenever the channel is ready for servicing. This includes whenever an operation on the channel may have a status change to report, as well as whenever there is no operation in progress on the channel (because the channel is ready to start a new operation).
An application which waits on an 'any channel' event will be woken when any of the channels which have been associated with that event are ready for servicing. In this case a channel which has no operation in progress is not considered to be ready for servicing. This is because 'any channel' events are provided for backward compatibility with Prosody version 1, which had this behaviour.
Note that an application may sometimes be woken even though no status change is found. This happens in certain cases where the API library discovers when checking the status that the change is not of a type appropriate to report to the application (which may be because it related to a facility not currently in use or because it is only for internal purposes within the library).
The eventType parameter indicates which type of event should be created, see sm_channel_set_event() API call description for more details.
An identifier for the new event object is stored in the location pointed at by eventId. You can wait on the event as described in smd_ev_wait().
0 if call completed successfully, otherwise a standard error such as:
This function is part of the Prosody generic API.