Warning, file /include/root/TMPWorker.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TMPWorker
0013 #define ROOT_TMPWorker
0014
0015 #include "MPCode.h"
0016 #include "MPSendRecv.h" //MPCodeBufPair
0017 #include "PoolUtils.h"
0018 #include "TSysEvtHandler.h" //TFileHandler
0019
0020 #include <memory> //unique_ptr
0021 #include <string>
0022 #include <sstream>
0023 #include <unistd.h> //pid_t
0024
0025 class TMPWorker {
0026 public:
0027 TMPWorker() : fNWorkers(0), fMaxNEntries(0),
0028 fProcessedEntries(0), fS(), fPid(0), fNWorker(0) { }
0029 TMPWorker(unsigned nWorkers, ULong64_t maxEntries)
0030 : fNWorkers(nWorkers), fMaxNEntries(maxEntries),
0031 fProcessedEntries(0), fS(), fPid(0), fNWorker(0) { }
0032 virtual ~TMPWorker() { }
0033
0034 TMPWorker(const TMPWorker &) = delete;
0035 TMPWorker &operator=(const TMPWorker &) = delete;
0036
0037 virtual void Init(int fd, unsigned workerN);
0038 void Run();
0039 TSocket *GetSocket() { return fS.get(); }
0040 pid_t GetPid() { return fPid; }
0041 unsigned GetNWorker() const { return fNWorker; }
0042
0043 protected:
0044 std::string fId;
0045 unsigned fNWorkers;
0046 ULong64_t fMaxNEntries;
0047 ULong64_t fProcessedEntries;
0048
0049 void SendError(const std::string& errmsg, unsigned int code = MPCode::kError);
0050
0051 private:
0052 virtual void HandleInput(MPCodeBufPair &msg);
0053
0054 std::unique_ptr<TSocket> fS;
0055 pid_t fPid;
0056 unsigned fNWorker;
0057 };
0058
0059 #endif