Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

Recursive Mutex
[Application Candies]

Collaboration diagram for Recursive Mutex:


Detailed Description

Thread synchronization support.

In addition to posting and waiting for events, Threads can use the provided recursive mutex funxtions to assert mutual access to shared data structures.

A recursive mutex is a mutex that can be locked several times by the thread that already owns the mutex.


Data Structures

struct  _MUTEX
struct  _mutex
 Recursive mutex. More...

Typedefs

typedef _MUTEX MUTEX
 Recursive mutex type.

Functions

void NutMutexInit (MUTEX *mutex)
 Create a mutex.
void NutMutexLock (MUTEX *mutex)
 Lock a mutex.
int NutMutexUnlock (MUTEX *mutex)
 Unlock a mutex.
int NutMutexTrylock (MUTEX *mutex)
 Attempt to lock a mutex without blocking.
int NutMutexDestroy (MUTEX *mutex)
 Free resources allocated for a mutex.


Function Documentation

void NutMutexInit MUTEX mutex  ) 
 

Create a mutex.

The type for the mutex is recursive

void NutMutexLock MUTEX mutex  ) 
 

Lock a mutex.

If the mutex is already locked by another thread, the thread will block until the mutex becomes available

Note:
: Should not be called from interrupt context

int NutMutexUnlock MUTEX mutex  ) 
 

Unlock a mutex.

Return zero, if successful, otherwise the current thread does not hold a lock on mutex.

Note:
: Should not be called from interrupt context

int NutMutexTrylock MUTEX mutex  ) 
 

Attempt to lock a mutex without blocking.

Return zero, if successful, otherwise the mutex is already locked by another thread

Note:
: Should not be called from interrupt context

int NutMutexDestroy MUTEX mutex  ) 
 

Free resources allocated for a mutex.

Return zero, if successful, otherwise the mutex is locked by another thread


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/