bps_initialize()

Initialize the BPS library for use with the caller's current thread.

Synopsis:

#include <bps/bps.h>
 
BPS_API int bps_initialize(void)

Since:

BlackBerry 10.0.0

Arguments:

Library:

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

Description:

The bps_initialize() function initializes the BPS library. This function must be the first BPS function you call for a thread when you want to use BPS library functions.

If initialization of the library fails, a BPS_FAILURE value is returned with errno value set. The use of any BPS library function without a successful invocation of the bps_initialize() functions results in undefined behavior.

Your application can call the bps_initialize() function more than once. An application that calls the bps_initialize() function multiple times should call the bps_shutdown() function the same number of times.

For multi-threaded applications, call the bps_initialize() function at the beginning of the thread, and call the bps_shutdown() function before the thread terminates. When the bps_initialize() function is called for a new thread, it automatically creates a default channel and sets it as the thread's active channel. Events are requested on a per-channel basis.

For example, when you want to receive navigator events on a new thread, call the navigator_request_events() function after calling bps_initialize() function, even if you had already called the navigator_request_events() function previously on a different thread. See the bps_channel_create() function for more details about channels.

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