diff options
Diffstat (limited to 'include/utils/Condition.h')
-rw-r--r-- | include/utils/Condition.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/utils/Condition.h b/include/utils/Condition.h index 8852d53..e63ba7e 100644 --- a/include/utils/Condition.h +++ b/include/utils/Condition.h @@ -48,6 +48,11 @@ public: SHARED = 1 }; + enum WakeUpType { + WAKE_UP_ONE = 0, + WAKE_UP_ALL = 1 + }; + Condition(); Condition(int type); ~Condition(); @@ -57,6 +62,14 @@ public: status_t waitRelative(Mutex& mutex, nsecs_t reltime); // Signal the condition variable, allowing one thread to continue. void signal(); + // Signal the condition variable, allowing one or all threads to continue. + void signal(WakeUpType type) { + if (type == WAKE_UP_ONE) { + signal(); + } else { + broadcast(); + } + } // Signal the condition variable, allowing all threads to continue. void broadcast(); |