Semaphore
[NUT/OS]


Data Structures

struct  _mutex
 Recursive mutex. More...
struct  _SEM

Typedefs

typedef _SEM SEM
 Sempahore type.

Functions

int NutSemDestroy (SEM *sem)
 Free resources allocated for a semaphore.
void NutSemInit (SEM *sem, short value)
 Initialize an unnamed semaphore to value.
void NutSemPost (SEM *sem)
 Unlock a sempahore.
int NutSemTryWait (SEM *sem)
 Attempt to lock a semaphore without blocking.
void NutSemWait (SEM *sem)
 Lock a semaphore.


Function Documentation

int NutSemDestroy ( SEM sem  ) 

Free resources allocated for a semaphore.

Return zero, if successful, otherwise there are threads blocked on the sempahore

void NutSemPost ( SEM sem  ) 

Unlock a sempahore.

Note:
: Should not be called from interrupt context

int NutSemTryWait ( SEM sem  ) 

Attempt to lock a semaphore without blocking.

Return zero, if successful, otherwise the sempahore is already locked

Note:
: Should not be called from interrupt context

void NutSemWait ( SEM sem  ) 

Lock a semaphore.

If the semaphore value is currently zero, then the calling thread will not return from the call to sem_wait() the semaphore becomes available

Note:
: Should not be called from interrupt context


Generated on Tue Jan 23 21:12:30 2007 for BTnut System Software by doxygen 1.4.7