ChibiOS/RT Logo ChibiOS/RT

Architecture - Reference Manual - Guides

Public Member Functions | Static Public Member Functions | Data Fields

chibios_rt::Mutex Class Reference

Class encapsulating a mutex. More...

#include <ch.hpp>

Public Member Functions

 Mutex (void)
 Mutex constructor.
bool TryLock (void)
 Tries a lock operation on the mutex.
void Lock (void)
 Locks the mutex.

Static Public Member Functions

static void Unlock (void)
 Unlocks the mutex.
static void UnlockAll (void)
 Unlocks all the mutexes owned by the invoking thread.

Data Fields

struct::Mutex mutex
 Embedded Mutex structure.

Detailed Description

Class encapsulating a mutex.

Definition at line 361 of file ch.hpp.


Constructor & Destructor Documentation

Mutex::Mutex ( void   ) 

Mutex constructor.

The embedded Mutex structure is initialized.

Definition at line 205 of file ch.cpp.

References chMtxInit(), and mutex.

Here is the call graph for this function:


Member Function Documentation

bool Mutex::TryLock ( void   ) 

Tries a lock operation on the mutex.

Return values:
TRUE if the mutex was successfully acquired
FALSE if the lock attempt failed.

Definition at line 210 of file ch.cpp.

References chMtxTryLock(), and mutex.

Here is the call graph for this function:

void Mutex::Lock ( void   ) 

Locks the mutex.

Performs a lock operation on the mutex, if the mutex is already locked then the thread enters the mutex priority queue and waits.

Definition at line 215 of file ch.cpp.

References chMtxLock(), and mutex.

Here is the call graph for this function:

void Mutex::Unlock ( void   )  [static]

Unlocks the mutex.

Performs an unlock operation on the mutex, the next waiting thread, if any, is resumed and locks the mutex.

Definition at line 220 of file ch.cpp.

References chMtxUnlock().

Here is the call graph for this function:

static void chibios_rt::Mutex::UnlockAll ( void   )  [static]

Unlocks all the mutexes owned by the invoking thread.

This operation is MUCH MORE efficient than releasing the mutexes one by one and not just because the call overhead, this function does not have any overhead related to the priority inheritance mechanism.


Field Documentation

Embedded Mutex structure.

Definition at line 366 of file ch.hpp.

Referenced by Lock(), Mutex(), and TryLock().


Generated on Sun Oct 24 2010 09:40:49 for ChibiOS/RT by doxygen 1.7.1