summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2015-05-09 16:01:23 +0300
committerEmil Velikov <[email protected]>2015-05-20 22:06:33 +0100
commit907ee1494faba1e8a53bbd95546ffda241f7d6cd (patch)
tree38211526dca13b8df0fa3cef1d7cc3eff5d6a081 /src
parentb4045dd5e9bbe3c29a8926ac66a42baf3d7cac9a (diff)
clover: Implement locking of the wait_count, _chain and _status members of event.
Tested-by: Tom Stellard <[email protected]> CC: 10.5 <[email protected]> (cherry picked from commit a533d4edf1ea346dd9e343c71b2cd500fa550ef8)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/clover/core/event.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/clover/core/event.cpp b/src/gallium/state_trackers/clover/core/event.cpp
index 969d19a54ae..e1f9de07f83 100644
--- a/src/gallium/state_trackers/clover/core/event.cpp
+++ b/src/gallium/state_trackers/clover/core/event.cpp
@@ -38,6 +38,7 @@ event::~event() {
std::vector<intrusive_ref<event>>
event::trigger_self() {
+ std::lock_guard<std::mutex> lock(mutex);
std::vector<intrusive_ref<event>> evs;
if (!--wait_count)
@@ -61,6 +62,7 @@ event::trigger() {
std::vector<intrusive_ref<event>>
event::abort_self(cl_int status) {
+ std::lock_guard<std::mutex> lock(mutex);
std::vector<intrusive_ref<event>> evs;
_status = status;
@@ -81,16 +83,22 @@ event::abort(cl_int status) {
bool
event::signalled() const {
+ std::lock_guard<std::mutex> lock(mutex);
return !wait_count;
}
cl_int
event::status() const {
+ std::lock_guard<std::mutex> lock(mutex);
return _status;
}
void
event::chain(event &ev) {
+ std::unique_lock<std::mutex> lock(mutex, std::defer_lock);
+ std::unique_lock<std::mutex> lock_ev(ev.mutex, std::defer_lock);
+ std::lock(lock, lock_ev);
+
if (wait_count) {
ev.wait_count++;
_chain.push_back(ev);