osrm-backend/Server/DataStructures/SharedBarriers.h

41 lines
1.1 KiB
C
Raw Normal View History

#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/interprocess/sync/named_condition.hpp>
2013-10-17 12:11:53 -04:00
struct SharedBarriers {
SharedBarriers ()
:
pending_update_mutex(
boost::interprocess::open_or_create,
"pending_update"
),
update_mutex(
boost::interprocess::open_or_create,
"update"
),
query_mutex(
boost::interprocess::open_or_create,
"query"
),
no_running_queries_condition(
boost::interprocess::open_or_create,
"no_running_queries"
),
update_ongoing(false),
number_of_queries(0)
{ }
2013-10-17 12:11:53 -04:00
// Mutex to protect access to the boolean variable
boost::interprocess::named_mutex pending_update_mutex;
boost::interprocess::named_mutex update_mutex;
boost::interprocess::named_mutex query_mutex;
2013-10-17 12:11:53 -04:00
// Condition that no update is running
boost::interprocess::named_condition no_running_queries_condition;
2013-10-17 12:11:53 -04:00
2013-10-18 15:58:07 -04:00
// Is there an ongoing update?
2013-10-17 12:11:53 -04:00
bool update_ongoing;
2013-10-18 15:58:07 -04:00
// Is there any query?
2013-10-17 12:11:53 -04:00
int number_of_queries;
};