+/**
+ * Namespace implementing a number of functions that are used to
+ * record the communication between master and detached
+ * processes. This is mainly for debugging purposes.
+ */
namespace CommunicationsLog
{
+ /**
+ * Type denoting the direction of a
+ * recorder communication.
+ */
enum Direction { put, get };
+ /**
+ * One record of a recorded
+ * communication.
+ */
struct Record
{
Direction direction;
std::string description;
};
+ /**
+ * The elements of a recorder
+ * communication
+ */
std::list<Record> communication_log;
+ /**
+ * Record a sent or received
+ * message
+ */
template <typename T>
void record_communication (const Direction direction,
const unsigned int count,
};
+ /**
+ * List all the communication that
+ * has happened.
+ */
void list_communication ()
{
std::cerr << "------------------------------" << std::endl
* about the parent process, so it is apparently gone
*/
extern "C"
-void monitor_parent_liveness (const pid_t master_pid, const pid_t primary_pid)
+void monitor_parent_liveness (const pid_t master_pid,
+ const pid_t primary_pid)
{
while (true)
{
if ((ret == -1) && (errno == ESRCH))
die ("Master process seems to have died!", primary_pid);
else
- die ("Unspecified error while checking for other process!", ret, errno, primary_pid);
+ die ("Unspecified error while checking for other process!",
+ ret, errno, primary_pid);
// ok, master still running,
// take a little rest and then
get (&master_pid, 1, "master_pid");
// ...and start off a thread that
// actually checks that
-// Threads::ThreadManager thread_manager;
-// Threads::spawn (thread_manager,
-// Threads::encapsulate (&monitor_parent_liveness)
-// .collect_args(master_pid, getpid()));
+ Threads::ThreadManager thread_manager;
+ Threads::spawn (thread_manager,
+ Threads::encapsulate (&monitor_parent_liveness)
+ .collect_args(master_pid, getpid()));
// then go into the action loop...
unsigned int N, NZ, NSTEPS, LA, MAXFRT, LIW;