It seems like the browser you are using has JavaScript disabled. As a result, the site will not function properly. We really want you to enable it so you may experience our site as we intended it. If you have no idea what we are talking about or if you need help, visit http://www.enable-javascript.com×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Oops, it seems like you're using an old browser that we do not fully support. If you're able to, please upgrade your browser here.×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Synopsis:

Since:

Arguments:

A pointer to a sync_t for the synchronization object.
You must have initialized this argument by calling
SyncTypeCreate()
or statically initialized it with the manifest
PTHREAD_COND_INITIALIZER.

mutex

The mutex that's associated with the condition variable.
You must lock this mutex by calling
SyncMutexLock()
(or the POSIX
pthread_mutex_lock()
cover routine).
The kernel releases the mutex lock in the kernel when it blocks the thread
on sync.

Library:

libc

Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.

Description:

The SyncCondvarWait() and SyncCondvarWait_r()
kernel calls block the calling thread on the synchronization object,
sync.
If more than one thread is blocked on the object, they're queued in priority
order.

These functions are similar,
except in the way they indicate errors. See the Returns section for details.

The blocked thread can be unblocked by any one of the following conditions:

Condition variable signalled

The condition variable was signaled by a call to
SyncCondvarSignal(),
that determined that this thread should be awakened.

Before returning from SyncCondvarWait(),
mutex is reacquired. If mutex is locked, the
thread enters into the STATE_MUTEX state waiting
for mutex to be unlocked. At this point it's as
though you had called SyncMutexLock(mutex).

Timeout

The wait was terminated by a timeout initiated by a previous call to
TimerTimeout().

Before returning from SyncCondvarWait(),
mutex is reacquired. If mutex is locked, the
thread enters into the STATE_MUTEX state waiting
for mutex to be unlocked. At this point it's as
though you had called SyncMutexLock(mutex).

POSIX signal

The wait was terminated by an unmasked signal initiated by a call to
SignalKill().
If a signal handler has been set up, the signal
handler runs with mutex unlocked. On return from the
signal handler, mutex is reacquired. If mutex
is locked, the thread enters into the STATE_MUTEX
state waiting for mutex to be unlocked. At this point, it's
as though you had called SyncMutexLock(mutex).

Thread cancellation

The wait was terminated by a thread cancellation initiated by a call
to
ThreadCancel().
Before calling the cancellation handler,
mutex is reacquired. If mutex is locked, the
thread enters into the STATE_MUTEX state waiting for
mutex to be unlocked. At this point, it's as though you
had called SyncMutexLock(mutex).

In all cases, mutex is reacquired before the call returns.
If the thread enters the STATE_MUTEX state, the rules
governing SyncMutexLock() are in effect.

Condition variables are used to block a thread until a certain condition
is satisfied.
Spurious wakeups may occur due to timeouts,
signals, and broadcast condition variable signals.
Therefore, you should always reevaluate the condition, even on a successful
return.
The easiest way to do this is with a while loop.
For example:

1. Download the tools

Before you start developing, you'll need to visit the Downloads tab. Here you'll find downloads for the BlackBerry 10 Native SDK, BlackBerry 10 Device Simulator, and some other useful tools.

2. Try the sample apps

Now featuring a filter control, the Sample apps tab allows you to search for samples by name or by feature.

Select either the Core or Cascades radio buttons to display the samples relevant to you.

3. Educate yourself

The Documentation tab contains tons of examples, tutorials, and best practices to guide you along the path towards building an awesome app.

You can access all the documentation that you need in the left-hand navigation.

4. Start developing

The Reference tab is where you'll find essential details about how to use our APIs.

You can use the left-hand navigation to choose how you would like to browse the reference: by module, by topic, or alphabetically. If you have an idea of what you are looking for, start typing it in the Filter box.