Skip to content

Commit 0140dc2

Browse files
committed
Added default constructor for Semaphore
Currently Semaphore can not be instantiated without an explicit count as a constructor argument. This limits where Semaphores can be declared and requires explicit initialization in several annoying places, such as in member variables and SingletonPtr targets. This adds a default count of 0, which has shown to be the most common initial value used for semaphores.
1 parent 3ea625c commit 0140dc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rtos/rtos/Semaphore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ namespace rtos {
3131
class Semaphore {
3232
public:
3333
/** Create and Initialize a Semaphore object used for managing resources.
34-
@param number of available resources; maximum index value is (count-1).
34+
@param number of available resources; maximum index value is (count-1). (default: 0).
3535
*/
36-
Semaphore(int32_t count);
36+
Semaphore(int32_t count=0);
3737

3838
/** Wait until a Semaphore resource becomes available.
3939
@param millisec timeout value or 0 in case of no time-out. (default: osWaitForever).

0 commit comments

Comments
 (0)