Embedded Multicore Building Blocks V1.0.0
|
#include <mutex.h>
Public Member Functions | |
Spinlock () | |
Creates a spinlock which is in unlocked state. More... | |
~Spinlock () | |
Destructs a spinlock. More... | |
void | Lock () |
Waits until the spinlock can be locked and locks it. More... | |
bool | TryLock (unsigned int number_spins=1) |
Tries to lock the spinlock for number_spins times and returns. More... | |
void | Unlock () |
Unlocks the spinlock. More... | |
embb::base::Spinlock::Spinlock | ( | ) |
Creates a spinlock which is in unlocked state.
embb::base::Spinlock::~Spinlock | ( | ) |
Destructs a spinlock.
void embb::base::Spinlock::Lock | ( | ) |
bool embb::base::Spinlock::TryLock | ( | unsigned int | number_spins = 1 | ) |
Tries to lock the spinlock for number_spins
times and returns.
true
if the spinlock could be locked, otherwise false
. [in] | number_spins | Maximal number of spins when trying to acquire the lock. Note that passing 0 here results in not trying to obtain the lock at all. The default parameter is 1. |