1al_wait_cond(3)                                                al_wait_cond(3)
2
3
4

NAME

6       al_wait_cond - Allegro 5 API
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              void al_wait_cond(ALLEGRO_COND *cond, ALLEGRO_MUTEX *mutex)
12

DESCRIPTION

14       On  entering this function, mutex must be locked by the calling thread.
15       The function will atomically release mutex  and  block  on  cond.   The
16       function  will  return  when cond is “signalled”, acquiring the lock on
17       the mutex in the process.
18
19       Example of proper use:
20
21              al_lock_mutex(mutex);
22              while (something_not_true) {
23                 al_wait_cond(cond, mutex);
24              }
25              do_something();
26              al_unlock_mutex(mutex);
27
28       The mutex should be locked before checking the condition, and should be
29       rechecked al_wait_cond(3) returns.  al_wait_cond(3) can return for oth‐
30       er reasons than the condition becoming true (e.g. the process was  sig‐
31       nalled).   If  multiple  threads are blocked on the condition variable,
32       the condition may no longer be true by the time the  second  and  later
33       threads are unblocked.  Remember not to unlock the mutex prematurely.
34

SEE ALSO

36       al_wait_cond_until(3), al_broadcast_cond(3), al_signal_cond(3).
37
38
39
40Allegro reference manual                                       al_wait_cond(3)
Impressum