bps_channel_create()

Create an event channel tied to the caller's current thread.

Synopsis:

#include <bps/bps.h>
 
BPS_API int bps_channel_create(int *chid, int flags)

Since:

BlackBerry 10.0.0

Arguments:

chid

After the function is called, the new channel ID is written to the specified value.

flags

(Reserved for future use). Additional flags that are reserved for future use. You should set this value to 0.

Library:

libbps (For the qcc command, use the -l bps option to link against this library)

Description:

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.

Returns:

BPS_SUCCESS when the function completes successfully, BPS_FAILURE with errno value set otherwise.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus