]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Exchange the pid of the master to the detached slave.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Sep 2002 21:28:41 +0000 (21:28 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Sep 2002 21:28:41 +0000 (21:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@6547 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/hsl/source/detached_ma27.cc
deal.II/lac/source/sparse_direct.cc

index 4f7f99a4e0c9fe03dafd100a58dd90a4f038a55d..d6eae8166556ec312cfd0d5717b4f6200c6a95b9 100644 (file)
 //
 //----------------------------  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>
 
@@ -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<unsigned int> IRN, ICN, IW, IKEEP, IW1;
index 2bba8eb3db46bafd88e03cac65b57f36749061f4..f0625e5e7a939717787bbc5ee2e0d73e85c4af4d 100644 (file)
@@ -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");
     };
   
   

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.