From: bangerth Date: Wed, 20 May 2009 19:59:42 +0000 (+0000) Subject: Remove the dependence of detached_ma27 on libbase. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b348d4cca12d401840a57af7f3cab1b54d092344;p=dealii-svn.git Remove the dependence of detached_ma27 on libbase. git-svn-id: https://svn.dealii.org/trunk@18870 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/Makefile b/deal.II/Makefile index 4ccc8def6f..b1c7fc8d1b 100644 --- a/deal.II/Makefile +++ b/deal.II/Makefile @@ -106,8 +106,7 @@ optimized: contrib baseo laco 2do 1do 3do # make sure the function parser is also built (it isn't in the default # build list of the subdirectory, since it needs to be built before # libbase -contrib: $(subst no,,$(subst yes,base,$(USE_CONTRIB_HSL))) \ - contrib-functionparser +contrib: contrib-functionparser cd $D/contrib && $(MAKE) contrib-functionparser: diff --git a/deal.II/contrib/hsl/Makefile b/deal.II/contrib/hsl/Makefile index 30d7e34982..ed83b2b08e 100644 --- a/deal.II/contrib/hsl/Makefile +++ b/deal.II/contrib/hsl/Makefile @@ -1,5 +1,5 @@ # $Id$ -# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008 by Wolfgang Bangerth +# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008, 2009 by Wolfgang Bangerth D = ../.. @@ -47,8 +47,7 @@ $(LIBDIR)/libhsl$(shared-lib-suffix): $(forward-declarations) $(o-files) # has actually nothing much to do, compile it in debug mode $(LIBDIR)/bin/detached_ma27$(EXEEXT): \ $(LIBDIR)/contrib/hsl/detached_ma27.$(OBJEXT) \ - -lhsl \ - $(lib-base.o) + -lhsl @echo =====hsl=========================$(MT)== Making $(@F) @$(CXX) $(CXXFLAGS.g) $^ -o $@ $(F77LIBS) -lpthread $(LIBS) diff --git a/deal.II/contrib/hsl/source/detached_ma27.cc b/deal.II/contrib/hsl/source/detached_ma27.cc index 33962d6d36..388062a0cb 100644 --- a/deal.II/contrib/hsl/source/detached_ma27.cc +++ b/deal.II/contrib/hsl/source/detached_ma27.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 2002, 2003, 2006, 2007, 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -12,7 +12,6 @@ //---------------------------- detached_ma27.cc --------------------------- #include -#include #include #include @@ -78,10 +77,19 @@ void die (const std::string &text, const T1 t1, const T2 t2, const pid_t pid) * parent. if the return value is non-null, then kill couldn't find out * about the parent process, so it is apparently gone */ +struct MonitorData +{ + const pid_t master_pid; + const pid_t primary_pid; +}; + + extern "C" -void monitor_parent_liveness (const pid_t master_pid, - const pid_t primary_pid) +void * monitor_parent_liveness (void *monitor_data) { + const pid_t master_pid = ((MonitorData*)monitor_data)->master_pid; + const pid_t primary_pid = ((MonitorData*)monitor_data)->primary_pid; + while (true) { int ret = kill (master_pid, 0); @@ -99,6 +107,8 @@ void monitor_parent_liveness (const pid_t master_pid, // ask again sleep (10); } + + return 0; } @@ -172,7 +182,9 @@ int main () // be kill when we exit the main // program, but part from that we // create it detached - Threads::spawn (&monitor_parent_liveness)(master_pid, getpid()); + static MonitorData monitor_data = { master_pid, getpid() }; + pthread_t thread; + pthread_create (&thread, 0, &monitor_parent_liveness, &monitor_data); // then go into the action loop... unsigned int N, NZ, NSTEPS, LA, MAXFRT, LIW;