Embedded Multicore Building Blocks V1.0.0
Classes
Mutex Concept

Concept for thread synchronization. More...

Classes

class  embb::base::Spinlock
 Spinlock. More...
 
class  embb::base::Mutex
 Non-recursive, exclusive mutex. More...
 
class  embb::base::RecursiveMutex
 Recursive, exclusive mutex. More...
 

Detailed Description

Concept for thread synchronization.

Description

The mutex concept is used for thread synchronization and provides a lock. At any point in time, only one thread can exclusively hold the lock and the lock is held until the thread explicitly releases it.

Requirements
  • Let Mutex be the mutex type
  • Let m be an object of type Mutex.
Valid Expressions
Expression Return type Description
Mutex() void Constructs a mutex.
m.TryLock() bool Tries to lock the mutex and immediately returns. Returns false, if the mutex could not be acquired (locked), otherwise true.
m.Lock() void Locks the mutex. When the mutex is already locked, the current thread is blocked until the mutex is unlocked.
m.Unlock() void Unlocks the mutex.