[complement-svn] SF.net SVN: complement: [1456] trunk/complement/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-12-14 14:23:02
|
Revision: 1456 http://svn.sourceforge.net/complement/?rev=1456&view=rev Author: complement Date: 2006-12-14 06:23:00 -0800 (Thu, 14 Dec 2006) Log Message: ----------- move 'fork' and 'become_daemon' from Thread class directly to namespace xmt Modified Paths: -------------- trunk/complement/explore/include/mt/xmt.h trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/xmt.cc trunk/complement/explore/test/mt/mt_test.cc trunk/complement/explore/test/sockios/read0_on_exec.cc trunk/complement/explore/test/stem/unit_test.cc Modified: trunk/complement/explore/include/mt/xmt.h =================================================================== --- trunk/complement/explore/include/mt/xmt.h 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/include/mt/xmt.h 2006-12-14 14:23:00 UTC (rev 1456) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/11/29 01:50:24 ptr> +// -*- C++ -*- Time-stamp: <06/12/14 17:08:37 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -1383,6 +1383,9 @@ { } }; +__FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ); +__FIT_DECLSPEC void become_daemon() throw( fork_in_parent, std::runtime_error ); + class Thread { public: @@ -1486,11 +1489,6 @@ static void gettime( timespec *t ) { xmt::gettime( t ); } -#ifndef _WIN32 - static __FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ); - static __FIT_DECLSPEC void become_daemon() throw( fork_in_parent, std::runtime_error ); -#endif - bool good() const { return (_state == goodbit) && (_id != bad_thread_id); } bool bad() const Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/lib/mt/ChangeLog 2006-12-14 14:23:00 UTC (rev 1456) @@ -1,3 +1,9 @@ +2006-12-14 Petr Ovtchenkov <pt...@is...> + + * xmt.h, xmt.cc: move 'fork' and 'become_daemon' from Thread + class directly to namespace xmt; this may block usage + of compilers without namespaces. + 2006-12-13 Petr Ovtchenkov <pt...@is...> * thr_mgr.h, thr_mgr.cc: add join method. Modified: trunk/complement/explore/lib/mt/xmt.cc =================================================================== --- trunk/complement/explore/lib/mt/xmt.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/lib/mt/xmt.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/11/29 03:10:16 ptr> +// -*- C++ -*- Time-stamp: <06/12/14 17:12:53 ptr> /* * Copyright (c) 1997-1999, 2002-2006 @@ -709,9 +709,8 @@ Thread::_exit( 0 ); } -#ifndef _WIN32 __FIT_DECLSPEC -void Thread::fork() throw( fork_in_parent, std::runtime_error ) +void fork() throw( fork_in_parent, std::runtime_error ) { #ifdef __unix // MT_REENTRANT( detail::_F_lock, _1 ); @@ -728,13 +727,14 @@ } __FIT_DECLSPEC -void Thread::become_daemon() throw( fork_in_parent, std::runtime_error ) +void become_daemon() throw( fork_in_parent, std::runtime_error ) { #ifdef __unix try { - Thread::fork(); + xmt::fork(); - // chdir( "/var/tmp" ); + chdir( "/var/tmp" ); // for CWD: if not done, process remain with same WD + // and don't allow unmount volume, for example ::setsid(); // become session leader ::close( 0 ); // close stdin ::close( 1 ); // close stdout @@ -752,7 +752,6 @@ } #endif } -#endif // _WIN32 // #ifdef __GNUC__ // void Thread::_create( const void *p, size_t psz ) Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/test/mt/mt_test.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -43,7 +43,7 @@ fcnd.set( false ); try { - xmt::Thread::fork(); + xmt::fork(); try { Modified: trunk/complement/explore/test/sockios/read0_on_exec.cc =================================================================== --- trunk/complement/explore/test/sockios/read0_on_exec.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/test/sockios/read0_on_exec.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -145,7 +145,7 @@ // cerr << "** 1" << endl; // cndf.set( false ); - xmt::Thread::fork(); // <---- key line + xmt::fork(); // <---- key line sem.wait(); // wait server for listen us // cerr << "** 2" << endl; Modified: trunk/complement/explore/test/stem/unit_test.cc =================================================================== --- trunk/complement/explore/test/stem/unit_test.cc 2006-12-14 12:04:02 UTC (rev 1455) +++ trunk/complement/explore/test/stem/unit_test.cc 2006-12-14 14:23:00 UTC (rev 1456) @@ -311,7 +311,7 @@ fcnd.set( false ); try { - xmt::Thread::fork(); + xmt::fork(); try { stem::NetTransportMgr mgr; @@ -423,7 +423,7 @@ try { // Client 1 - xmt::Thread::fork(); + xmt::fork(); #if 0 struct sigaction action; struct sigaction old_action; @@ -524,7 +524,7 @@ try { // Client 2 - xmt::Thread::fork(); + xmt::fork(); #if 0 struct sigaction action; @@ -619,7 +619,7 @@ try { // Client - xmt::Thread::fork(); + xmt::fork(); try { fcnd.try_wait(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |