25 explicit TMPClient(
unsigned nWorkers = 0);
32 unsigned Broadcast(
unsigned code,
unsigned nMessages = 0);
33 template<
class T>
unsigned Broadcast(
unsigned code,
const std::vector<T> &objs);
34 template<
class T>
unsigned Broadcast(
unsigned code, std::initializer_list<T> &objs);
35 template<
class T>
unsigned Broadcast(
unsigned code, T obj,
unsigned nMessages = 0);
77 std::unique_ptr<TList> lp(
fMon.GetListOfActives());
79 unsigned nArgs = args.size();
87 Error(
"TMPClient::Broadcast",
"[E] Could not send message to server\n");
102 std::vector<T> vargs(std::move(args));
128 std::unique_ptr<TList> lp(
fMon.GetListOfActives());
130 if (count == nMessages)
136 Error(
"TMPClient::Broadcast",
"[E] Could not send message to server\n");
int MPSend(TSocket *s, unsigned code)
Send a message with the specified code on the specified socket.
std::pair< unsigned, std::unique_ptr< TBufferFile > > MPCodeBufPair
An std::pair that wraps the code and optional object contained in a message.
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
unsigned GetNWorkers() const
unsigned fNWorkers
The number of workers that should be spawned upon forking.
TMPClient(unsigned nWorkers=0)
Class constructor.
unsigned Broadcast(unsigned code, unsigned nMessages=0)
Send a message with the specified code to at most nMessages workers.
TMPClient & operator=(const TMPClient &)=delete
std::vector< pid_t > fWorkerPids
A vector containing the PIDs of children processes/workers.
~TMPClient()
Class destructor.
TMonitor fMon
This object manages the sockets and detect socket events via TMonitor::Select.
void HandleMPCode(MPCodeBufPair &msg, TSocket *sender)
Handle messages containing an EMPCode.
void ReapWorkers()
Wait on worker processes and remove their pids from fWorkerPids.
TMPClient(const TMPClient &)=delete
void SetNWorkers(unsigned n)
Set the number of workers that will be spawned by the next call to Fork().
void Remove(TSocket *s)
Remove a certain socket from the monitor.
bool Fork(TMPWorker &server)
This method forks the ROOT session into fNWorkers children processes.
bool fIsParent
This is true if this is the parent/client process, false if this is a child/worker process.
void DeActivate(TSocket *s)
DeActivate a certain socket.
This class works in conjuction with TMPClient, reacting to messages received from it as specified by ...
This class implements client sockets.