7#include <boost/interprocess/ipc/message_queue.hpp>
27 prctl( PR_SET_PDEATHSIG, SIGHUP );
47 if (
this != &other ) {
69 if ( ! queue.name().empty() ) {
80 if ( ! queue.name().empty() ) {
92 std::string strptr(
"");
94 size_t ptrsize =
sizeof(func);
95 char* charptr =
new char[ptrsize];
96 memcpy(charptr,&func,ptrsize);
97 strptr=std::string(charptr,ptrsize);
100 bool send_ok =
m_inbox.try_send(strptr);
104 std::string strparam = (args?std::string((
char*)args->data,args->size):std::string(
""));
105 send_ok =
m_inbox.try_send(strparam);
111int Process::mainloop() {
125 if(message.empty())
break;
129 memcpy(&decoder,message.data(),message.size());
134 params.data = (
void*)message.data();
135 params.size = message.size();
138 std::unique_ptr<ScheduledWork> outwork = (*decoder)(params);
141 bool posted =
m_outbox.
try_send(std::string((
char*)outwork->data,outwork->size));
144 int errflag = *((
int*)outwork->data);
virtual bool try_send(const std::string &)
IdentifiedSharedQueue m_outbox
bool connectOut(const IdentifiedSharedQueue &queue)
bool connectIn(const SharedQueue &queue)
bool schedule(const IMessageDecoder *func, const ScheduledWork *args)
Process & operator=(const Process &other)
pid_t getProcessID() const
virtual std::string receive()