Implements a shared-memory parallel LUA scripting engine using OpenMP.

See issue #506
This commit is contained in:
DennisOSRM
2012-11-19 19:04:59 +01:00
parent 7e9eaaddc4
commit 94657a3258
8 changed files with 240 additions and 118 deletions
+4 -4
View File
@@ -37,7 +37,7 @@ class ConcurrentQueue {
public:
ConcurrentQueue(const size_t max_size) : internal_queue(max_size) { }
void push(Data const& data) {
inline void push(Data const& data) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&ConcurrentQueue<Data>::is_not_full, this));
internal_queue.push_back(data);
@@ -45,11 +45,11 @@ public:
m_not_empty.notify_one();
}
bool empty() const {
inline bool empty() const {
return internal_queue.empty();
}
void wait_and_pop(Data& popped_value) {
inline void wait_and_pop(Data& popped_value) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&ConcurrentQueue<Data>::is_not_empty, this));
popped_value=internal_queue.front();
@@ -58,7 +58,7 @@ public:
m_not_full.notify_one();
}
bool try_pop(Data& popped_value) {
inline bool try_pop(Data& popped_value) {
boost::mutex::scoped_lock lock(m_mutex);
if(internal_queue.empty()) {
return false;