#include "thread.h"Data Structures | |
| struct | Sema |
Functions | |
| void | Ns_SemaInit (Ns_Sema *semaPtr, int count) |
| void | Ns_SemaDestroy (Ns_Sema *semaPtr) |
| void | Ns_SemaWait (Ns_Sema *semaPtr) |
| void | Ns_SemaPost (Ns_Sema *semaPtr, int count) |
| void Ns_SemaDestroy | ( | Ns_Sema * | semaPtr | ) |
----------------------------------------------------------------------
Ns_SemaDestroy --
Destroy a semaphore. This routine is almost never used as synchronization objects are normally created at process startup and exist until the process exits.
Results: None.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SemaInit | ( | Ns_Sema * | semaPtr, | |
| int | count | |||
| ) |
----------------------------------------------------------------------
Ns_SemaInit --
Initialize a semaphore. Note that because semaphores are initialized with a starting count they cannot be automatically created on first use as with other synchronization objects.
Results: None.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SemaPost | ( | Ns_Sema * | semaPtr, | |
| int | count | |||
| ) |
----------------------------------------------------------------------
Ns_SemaPost --
Increment a semaphore count, releasing waiting threads if needed.
Results: None.
Side effects: Threads waiting on the condition, if any, may be resumed.
----------------------------------------------------------------------
| void Ns_SemaWait | ( | Ns_Sema * | semaPtr | ) |
----------------------------------------------------------------------
Ns_SemaWait --
Wait for a semaphore count to be greater than zero.
Results: None.
Side effects: Calling thread may wait on the condition.
----------------------------------------------------------------------
1.5.1