clover: Wrap event::_status in a method to prevent unlocked access.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
CC: 10.5 <mesa-stable@lists.freedesktop.org>
This commit is contained in:
Francisco Jerez 2015-05-09 16:22:33 +03:00
parent 2232b929fd
commit 4022a468b2
2 changed files with 12 additions and 7 deletions

View file

@ -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) {

View file

@ -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;