mirror of https://github.com/ARMmbed/mbed-os.git
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.pull/2189/head
parent
3ea625c8eb
commit
0140dc2e80
|
@ -31,9 +31,9 @@ namespace rtos {
|
|||
class Semaphore {
|
||||
public:
|
||||
/** Create and Initialize a Semaphore object used for managing resources.
|
||||
@param number of available resources; maximum index value is (count-1).
|
||||
@param number of available resources; maximum index value is (count-1). (default: 0).
|
||||
*/
|
||||
Semaphore(int32_t count);
|
||||
Semaphore(int32_t count=0);
|
||||
|
||||
/** Wait until a Semaphore resource becomes available.
|
||||
@param millisec timeout value or 0 in case of no time-out. (default: osWaitForever).
|
||||
|
|
Loading…
Reference in New Issue