aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2015-01-24 01:24:05 +0000
committerGil Pitney <gil.pitney@linaro.org>2015-01-24 01:24:05 +0000
commit7d4dc14b234dc3a2085a9e424d694fb5d920bd8d (patch)
treeebc0b5672d586fd0558d41ae387dd664131c4930
parent9ec42f77d26b7d0f06d3db98b0db4353c702141b (diff)
LLVM 3.6: Make addDependentEvent() const
More updates due to C++11, used by LLVM. Made addDependentEvent() const function. As a result, cast away const on some pthread library function calls and other calls in that const member function. Also, made p_dependent_events mutable, since std library functions were working on it. Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--src/core/commandqueue.cpp12
-rw-r--r--src/core/commandqueue.h4
2 files changed, 9 insertions, 7 deletions
diff --git a/src/core/commandqueue.cpp b/src/core/commandqueue.cpp
index 662dad1..d6a8f88 100644
--- a/src/core/commandqueue.cpp
+++ b/src/core/commandqueue.cpp
@@ -714,18 +714,20 @@ void Event::setStatus(Status status)
setStatusHelper(status);
}
-bool Event::addDependentEvent(Event *event)
+bool Event::addDependentEvent(Event *event) const
{
- pthread_mutex_lock(&p_state_mutex);
+ pthread_mutex_lock(const_cast<pthread_mutex_t *>(&p_state_mutex));
if (p_status == Event::Complete)
{
- pthread_mutex_unlock(&p_state_mutex);
+ pthread_mutex_unlock(const_cast<pthread_mutex_t *>(&p_state_mutex));
return false;
}
p_dependent_events.push_back(event);
- Object::reference(); // retain this event
- pthread_mutex_unlock(&p_state_mutex);
+
+ Coal::Event *tmp_event = const_cast<Coal::Event *>(this);
+ tmp_event->reference(); // retain this event
+ pthread_mutex_unlock(const_cast<pthread_mutex_t *>(&p_state_mutex));
return true;
}
diff --git a/src/core/commandqueue.h b/src/core/commandqueue.h
index 7d2c65e..9a6013c 100644
--- a/src/core/commandqueue.h
+++ b/src/core/commandqueue.h
@@ -444,7 +444,7 @@ class Event : public Object
* no need to add and return false.
* \param event the event to be notified
*/
- bool addDependentEvent(Event *event);
+ bool addDependentEvent(Event *event) const;
/**
* \brief Remove event from p_wait_events, which should be waited on
@@ -480,7 +480,7 @@ class Event : public Object
// p_wait_events: I should wait after these events complete
// p_dependent_events: when I complete, I should notify these events
std::list<const Event *> p_wait_events;
- std::vector<Event *> p_dependent_events;
+ mutable std::vector<Event *> p_dependent_events;
};
}