21namespace MultiProcess {
56 for (std::size_t ix = 0; ix < process_manager.
N_workers(); ++ix) {
59 for (
auto &channel :
mw_) {
62 }
else if (process_manager.
is_queue()) {
65 for (std::size_t ix = 0; ix < process_manager.
N_workers(); ++ix) {
73 throw std::runtime_error(
"Messenger ctor: I'm neither master, nor queue, nor a worker");
125 throw std::runtime_error(
"SIGTERM received in test_receive, aborting\n");
129 throw std::runtime_error(
130 "Messenger::test_connections: RECEIVE over connection failed, did not receive expected value!");
147 }
else if (process_manager.
is_queue()) {
152 for (std::size_t ix = 0; ix < process_manager.
N_workers(); ++ix) {
184 }
else if (process_manager.
is_worker()) {
191 throw std::runtime_error(
"Messenger::test_connections: I'm neither master, nor queue, nor a worker");
200 for (
auto &channel :
qw_) {
201 poller.register_channel(channel);
235 throw std::logic_error(
"Messenger::select_worker_channel_on_master: poll returned no readable channels");
256#define PROCESS_VAL(p) \
257 case (p): s = #p; break;
264 default: s = std::to_string(
static_cast<int>(
value));
274 default: s = std::to_string(
static_cast<int>(
value));
285 default: s = std::to_string(
static_cast<int>(
value));
296 default: s = std::to_string(
static_cast<int>(
value));
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
One endpoint of a full-duplex interprocess message pipe.
std::vector< Channel > qw_
void test_receive(X2X expected_ping_value, test_rcv_pipes rcv_pipe, std::size_t worker_id)
Channel & select_worker_channel_on_master()
On master: pick the worker channel to receive the next message from.
void test_connections(const ProcessManager &process_manager)
Test whether the channels between all processes are working.
std::vector< Channel > mw_
std::pair< Poller, std::size_t > create_worker_poller()
Helper function that creates a poller for worker_loop()
Messenger(ProcessManager &process_manager)
void send_from_queue_to_master()
std::pair< Poller, std::size_t > create_queue_poller()
Helper function that creates a poller for Queue::loop()
void send_from_master_to_queue()
void update_worker_channel_on_master(Channel &channel, bool more)
void debug_print(std::string s)
Function called from send and receive template functions in debug builds used to monitor the messages...
std::size_t mw_next_poll_position_
Channel * mw_current_source_
void send_from_queue_to_worker(std::size_t this_worker_id)
void test_send(X2X ping_value, test_snd_pipes snd_pipe, std::size_t worker_id)
void send_from_worker_to_queue()
Waits for input on a set of registered Channels.
std::vector< std::size_t > poll(int timeout_ms=-1) const
Wait for input; returns the registration indices of readable channels.
std::size_t register_channel(const Channel &channel)
Register a channel for input polling; returns its stable index.
Fork processes for queue and workers.
std::size_t N_workers() const
int claim_mw_fd(std::size_t worker_ix)
Hand over the master-worker channel end for the current process type.
static bool sigterm_received()
int claim_mq_fd()
Hand over the master-queue channel end for the current process type.
int claim_qw_fd(std::size_t worker_ix)
Hand over the queue-worker channel end for the current process type.
std::size_t worker_id() const
Thrown when a blocking wait on a Channel is interrupted, e.g.
std::ostream & operator<<(std::ostream &out, const Message &msg)
std::tuple< std::vector< std::size_t >, bool > careful_poll(Poller &poller)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...