|  | libgpac
    Documentation of the core library of GPAC | 
Semaphore. More...
 Collaboration diagram for Semaphore:
 Collaboration diagram for Semaphore:| Functions | |
| GF_Semaphore * | gf_sema_new (u32 MaxCount, u32 InitCount) | 
| semaphore constructor | |
| void | gf_sema_del (GF_Semaphore *sm) | 
| semaphore destructor | |
| Bool | gf_sema_notify (GF_Semaphore *sm, u32 nb_rel) | 
| semaphore notification. | |
| Bool | gf_sema_wait (GF_Semaphore *sm) | 
| semaphore wait | |
| Bool | gf_sema_wait_for (GF_Semaphore *sm, u32 time_out) | 
| semaphore time wait | |
Semaphore.
The semaphore object allows controlling how portions of the code (typically access to variables) are executed by two threads (or a thread and the main process) at the same time. The best image for a semaphore is a limited set of money coins (always easy to understand hmm?). If no money is in the set, nobody can buy anything until a coin is put back in the set. When the set is full, the money is wasted (call it "the bank"...).
semaphore constructor
Constructs a new semaphore object
| MaxCount | the maximum notification count of this semaphore | 
| InitCount | the initial notification count of this semaphore upon construction | 
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void gf_sema_del | ( | GF_Semaphore * | sm | ) | 
semaphore destructor
Destructs the semaphore object. This will wait for the semaphore to be released if needed.
| sm | the semaphore object | 
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:semaphore notification.
Notifies the semaphore of a certain amount of releases.
| sm | the semaphore object | 
| nb_rel | sm the number of release to notify | 
 Here is the caller graph for this function:
 Here is the caller graph for this function:| Bool gf_sema_wait | ( | GF_Semaphore * | sm | ) | 
semaphore wait
Waits for the semaphore to be accessible (eg, may wait an infinite time).
| sm | the semaphore object | 
 Here is the caller graph for this function:
 Here is the caller graph for this function:semaphore time wait
Waits for a certain for the semaphore to be accessible, and returns when semaphore is accessible or wait time has passed.
| sm | the semaphore object | 
| time_out | the amount of time to wait for the release in milliseconds | 
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function: