Creates an event channel tied to the caller's current thread.
BPS_API int bps_channel_create(int *chid, int flags)
- After the function is called, the new channel ID is written to the specified value.
- (Reserved for future use). Additional flags that are reserved for future use. You should set this value to 0.
The bps_channel_create() function causes the platform services to create a channel on behalf of the application. This channel allows the application to receive platform services events by making it active through the bps_channel_set_active() function.
A channel is an event queue, a set of file descriptors with callbacks, and a set of domain data. The channel monitors the I/O state of its file descriptors and fires registered callbacks when the appropriate conditions are met. Channels are tied to the thread that created them. A channel in one thread cannot be used by another thread. Events can be pushed from one channel to another using the bps_channel_push_event() function.
When platform services are initialized using the bps_initialize() function, a default event channel is created and set as the active channel. You may want your application to create additional channels and associate different services to different channels. Multiple channels can be associated with the same thread. You can switch channel using the bps_channel_set_active() function.
BPS_SUCCESS when the function completes successfully, BPS_FAILURE with the errno value set otherwise.