From 0140dc2e809069178295f81ed5e8d647b5b4219a Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 18 Jul 2016 14:51:38 -0500 Subject: [PATCH] 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. --- rtos/rtos/Semaphore.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtos/rtos/Semaphore.h b/rtos/rtos/Semaphore.h index b4d294256a..aeb4636c2f 100644 --- a/rtos/rtos/Semaphore.h +++ b/rtos/rtos/Semaphore.h @@ -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).