From 718a32c0db1f85ffc601c41765d471357f1fa332 Mon Sep 17 00:00:00 2001 From: Gil Pitney Date: Wed, 28 Jan 2015 23:54:30 +0000 Subject: commandqueue: Removed redundant mutex locking in Event::addDependentEvent() The commandqueue sanity test (tests/test_commandqueue.cpp) was failing. This was due to a lock being taken twice in a row from the same thread, with a mutex type of PTHREAD_MUTEX_DEFAULT, where re-locking produces undefined behaviour. Signed-off-by: Gil Pitney --- src/core/commandqueue.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/core/commandqueue.cpp b/src/core/commandqueue.cpp index d6a8f88..f721ff3 100644 --- a/src/core/commandqueue.cpp +++ b/src/core/commandqueue.cpp @@ -716,10 +716,8 @@ void Event::setStatus(Status status) bool Event::addDependentEvent(Event *event) const { - pthread_mutex_lock(const_cast(&p_state_mutex)); if (p_status == Event::Complete) { - pthread_mutex_unlock(const_cast(&p_state_mutex)); return false; } @@ -727,7 +725,6 @@ bool Event::addDependentEvent(Event *event) const Coal::Event *tmp_event = const_cast(this); tmp_event->reference(); // retain this event - pthread_mutex_unlock(const_cast(&p_state_mutex)); return true; } -- cgit v1.2.3