ChibiOS/RT Architecture - Reference Manual - Guides |
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. |
Class encapsulating a mutex.
Definition at line 361 of file ch.hpp.
Mutex::Mutex | ( | void | ) |
bool Mutex::TryLock | ( | void | ) |
Tries a lock operation on the mutex.
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.
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.
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().
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.