Lee Shen / FTHR_USB_serial_qSPI
Embed: (wiki syntax)

« Back to documentation index

Semaphore Class Reference

Semaphore Class Reference
[Rtos]

The Semaphore class is used to manage and protect access to a set of shared resources. More...

#include <Semaphore.h>

Inherits NonCopyable< Semaphore >.

Public Member Functions

 Semaphore (int32_t count=0)
 Create and Initialize a Semaphore object used for managing resources.
 Semaphore (int32_t count, uint16_t max_count)
 Create and Initialize a Semaphore object used for managing resources.
int32_t wait (uint32_t millisec=osWaitForever)
 Wait until a Semaphore resource becomes available.
osStatus release (void)
 Release a Semaphore resource that was obtain with Semaphore::wait.

Detailed Description

The Semaphore class is used to manage and protect access to a set of shared resources.

Note:
Memory considerations: The semaphore control structures will be created on current thread's stack, both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).

Definition at line 41 of file Semaphore.h.


Constructor & Destructor Documentation

Semaphore ( int32_t  count = 0 )

Create and Initialize a Semaphore object used for managing resources.

Parameters:
countnumber of available resources; maximum index value is (count-1). (default: 0).

Definition at line 29 of file Semaphore.cpp.