use named mtx's and condition for interprocess communication
This commit is contained in:
parent
9fe1680c56
commit
49a8980dea
@ -1,17 +1,37 @@
|
|||||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
#include <boost/interprocess/sync/named_mutex.hpp>
|
||||||
#include <boost/interprocess/sync/interprocess_condition.hpp>
|
#include <boost/interprocess/sync/named_condition.hpp>
|
||||||
|
|
||||||
struct SharedBarriers {
|
struct SharedBarriers {
|
||||||
|
|
||||||
SharedBarriers () : update_ongoing(false), number_of_queries(0) { }
|
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)
|
||||||
|
{ }
|
||||||
|
|
||||||
// Mutex to protect access to the boolean variable
|
// Mutex to protect access to the boolean variable
|
||||||
boost::interprocess::interprocess_mutex pending_update_mutex;
|
boost::interprocess::named_mutex pending_update_mutex;
|
||||||
boost::interprocess::interprocess_mutex update_mutex;
|
boost::interprocess::named_mutex update_mutex;
|
||||||
boost::interprocess::interprocess_mutex query_mutex;
|
boost::interprocess::named_mutex query_mutex;
|
||||||
|
|
||||||
// Condition that no update is running
|
// Condition that no update is running
|
||||||
boost::interprocess::interprocess_condition no_running_queries_condition;
|
boost::interprocess::named_condition no_running_queries_condition;
|
||||||
|
|
||||||
// Is there an ongoing update?
|
// Is there an ongoing update?
|
||||||
bool update_ongoing;
|
bool update_ongoing;
|
||||||
|
Loading…
Reference in New Issue
Block a user