From ee5b1afb6f81d7eeac7c5392b5348d6e87137c71 Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 27 Sep 2002 21:28:41 +0000 Subject: [PATCH] Exchange the pid of the master to the detached slave. git-svn-id: https://svn.dealii.org/trunk@6547 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/contrib/hsl/source/detached_ma27.cc | 14 ++++++++++++-- deal.II/lac/source/sparse_direct.cc | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/deal.II/contrib/hsl/source/detached_ma27.cc b/deal.II/contrib/hsl/source/detached_ma27.cc index 4f7f99a4e0..d6eae81665 100644 --- a/deal.II/contrib/hsl/source/detached_ma27.cc +++ b/deal.II/contrib/hsl/source/detached_ma27.cc @@ -11,11 +11,13 @@ // //---------------------------- detached_ma27.cc --------------------------- -#include -#include #include + #include #include +#include + +#include #include #include @@ -69,6 +71,14 @@ void get (T *t, const size_t N, const char */*debug_info*/) 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 IRN, ICN, IW, IKEEP, IW1; diff --git a/deal.II/lac/source/sparse_direct.cc b/deal.II/lac/source/sparse_direct.cc index 2bba8eb3db..f0625e5e7a 100644 --- a/deal.II/lac/source/sparse_direct.cc +++ b/deal.II/lac/source/sparse_direct.cc @@ -390,8 +390,18 @@ SparseDirectMA27::initialize (const SparsityPattern &sp) 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"); }; -- 2.39.5