[Mesa-dev] [PATCH 2/3] clover: Wrap event::_status in a method to prevent unlocked access.
Francisco Jerez
currojerez at riseup.net
Sat May 9 06:42:30 PDT 2015
---
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<event> &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<event> &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<intrusive_ref<event>> deps;
private:
@@ -88,6 +87,7 @@ namespace clover {
std::vector<intrusive_ref<event>> abort_self(cl_int status);
unsigned wait_count;
+ cl_int _status;
action action_ok;
action action_fail;
std::vector<intrusive_ref<event>> _chain;
--
2.3.5
More information about the mesa-dev
mailing list