summaryrefslogtreecommitdiff
path: root/src/components/utils/src/conditional_variable_posix.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/utils/src/conditional_variable_posix.cc')
-rw-r--r--src/components/utils/src/conditional_variable_posix.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/components/utils/src/conditional_variable_posix.cc b/src/components/utils/src/conditional_variable_posix.cc
index a89f8cab65..9efae01c53 100644
--- a/src/components/utils/src/conditional_variable_posix.cc
+++ b/src/components/utils/src/conditional_variable_posix.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -83,6 +83,15 @@ void ConditionalVariable::Broadcast() {
}
+void ConditionalVariable::Wait(Lock& lock) {
+ lock.AssertTakenAndMarkFree();
+ int32_t wait_status = pthread_cond_wait(&cond_var_,
+ &lock.mutex_);
+ lock.AssertFreeAndMarkTaken();
+ if (wait_status != 0)
+ LOG4CXX_ERROR(logger_, "Failed to wait for conditional variable");
+}
+
void ConditionalVariable::Wait(AutoLock& auto_lock) {
Lock& lock = auto_lock.GetLock();
lock.AssertTakenAndMarkFree();