Class Semaphore

Class Documentation

class util::Semaphore

A FreeRTOS Semaphore abstraction.

Public Functions

Semaphore(const char *dbg_name)

Construct a new.

Parameters
  • dbg_name: name of the semaphore for debugging purposes

Semaphore(Semaphore &&other)

Construct a new Semaphore from other moved Semaphore.

Parameters
  • other:

~Semaphore()
Semaphore(Semaphore const&) = delete
Semaphore &operator=(Semaphore const&) = delete
Semaphore &operator=(Semaphore&&) = delete
void take()

Take or “lock” this semaphore.

bool take(std::uint32_t timeout_ms)

Take a semaphore.

Take a semaphore but return if we haven’t obtained it in the given period of milliseconds.

Return

  • true: we took the semaphore.

  • false: we didn’t take the semaphore.

Parameters
  • [in] timeout_ms: Timeout in milliseconds.

void give()

Give or “unlock” this semaphore.

void wait()

Waits for this semaphore to be “given”.