From 4022a468b2976c65e0d2afe9c9ac5804729e8641 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Sat, 9 May 2015 16:22:33 +0300 Subject: [PATCH] clover: Wrap event::_status in a method to prevent unlocked access. Tested-by: Tom Stellard CC: 10.5 --- src/gallium/state_trackers/clover/core/event.cpp | 15 ++++++++++----- src/gallium/state_trackers/clover/core/event.hpp | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/clover/core/event.cpp b/src/gallium/state_trackers/clover/core/event.cpp index d03e0b4..969d19a 100644 --- a/src/gallium/state_trackers/clover/core/event.cpp +++ b/src/gallium/state_trackers/clover/core/event.cpp @@ -27,7 +27,7 @@ using namespace clover; event::event(clover::context &ctx, const ref_vector &deps, action action_ok, action action_fail) : - context(ctx), _status(0), wait_count(1), + context(ctx), wait_count(1), _status(0), action_ok(action_ok), action_fail(action_fail) { for (auto &ev : deps) ev.chain(*this); @@ -84,6 +84,11 @@ event::signalled() const { return !wait_count; } +cl_int +event::status() const { + return _status; +} + void event::chain(event &ev) { if (wait_count) { @@ -122,8 +127,8 @@ cl_int hard_event::status() const { pipe_screen *screen = queue()->device().pipe; - if (_status < 0) - return _status; + if (event::status() < 0) + return event::status(); else if (!_fence) return CL_QUEUED; @@ -213,8 +218,8 @@ soft_event::soft_event(clover::context &ctx, const ref_vector &deps, cl_int soft_event::status() const { - if (_status < 0) - return _status; + if (event::status() < 0) + return event::status(); else if (!signalled() || any_of([](const event &ev) { diff --git a/src/gallium/state_trackers/clover/core/event.hpp b/src/gallium/state_trackers/clover/core/event.hpp index f638c5b..6469e48 100644 --- a/src/gallium/state_trackers/clover/core/event.hpp +++ b/src/gallium/state_trackers/clover/core/event.hpp @@ -66,7 +66,7 @@ namespace clover { void abort(cl_int status); bool signalled() const; - virtual cl_int status() const = 0; + virtual cl_int status() const; virtual command_queue *queue() const = 0; virtual cl_command_type command() const = 0; virtual void wait() const; @@ -80,7 +80,6 @@ namespace clover { protected: void chain(event &ev); - cl_int _status; std::vector> deps; private: @@ -88,6 +87,7 @@ namespace clover { std::vector> abort_self(cl_int status); unsigned wait_count; + cl_int _status; action action_ok; action action_fail; std::vector> _chain; -- 2.7.4