//
//---------------------------- detached_ma27.cc ---------------------------
-#include <cstdio>
-#include <unistd.h>
#include <hsl/hsl.h>
+
#include <vector>
#include <iostream>
+#include <cstdio>
+
+#include <unistd.h>
#include <errno.h>
#include <sys/errno.h>
int main ()
{
+ // first action is to get the pid
+ // of the master process, so that
+ // we can check whether it is still
+ // alive or not...
+ pid_t master_pid;
+ get (&master_pid, 1, "master_pid");
+
+ // then go into the action loop...
unsigned int N, NZ, NSTEPS, LA, MAXFRT, LIW;
int IFLAG;
std::vector<unsigned int> IRN, ICN, IW, IKEEP, IW1;
ExcMessage ("execv returned, which it is not supposed to do!"));
std::exit(1);
};
- // parent process continues here.
- // close unneeded end of pipe
+ // parent process continues
+ // here. first thing is to
+ // send the process id of the
+ // present process. this is
+ // used to make sure that the
+ // client can end itself when
+ // it finds that the master
+ // process was somehow
+ // terminated without sending
+ // him this information
+ const pid_t parent_pid = std::getpid();
+ detached_mode_data->put (&parent_pid, 1, "parent_pid");
};