[complement-svn] SF.net SVN: complement: [1939] trunk/complement/explore/lib/mt
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-07-02 05:36:40
|
Revision: 1939 http://complement.svn.sourceforge.net/complement/?rev=1939&view=rev Author: complement Date: 2008-07-01 22:36:38 -0700 (Tue, 01 Jul 2008) Log Message: ----------- fix generation of uids; libxmt 2.0.5. Avoid fstream in uid generation: only 'read' need here: it atomic, that's why allow to skip mutexes. In shared memory test use tr2::condition_event_ip and tr2::barrier_ip (extention to wg21 draft). Modified Paths: -------------- trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/Makefile.inc trunk/complement/explore/lib/mt/uid.cc trunk/complement/explore/lib/mt/ut/Makefile trunk/complement/explore/lib/mt/ut/Makefile.inc trunk/complement/explore/lib/mt/ut/mt_test_suite.cc trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc trunk/complement/explore/lib/mt/ut/mt_test_wg21.h trunk/complement/explore/lib/mt/ut/shm_test.cc Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/ChangeLog 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,3 +1,14 @@ +2008-07-02 Petr Ovtchenkov <pt...@is...> + + * uid.cc: fix generation of uids; + + * mt_test_suite.cc, mt_test_wg21.cc, mt_test_wg21.h: test + for uids; use options for test suite; + + * shm_test.cc: use WG21-style conditionals; + + * libxmt: bump revision to 2.0.5. + 2008-06-30 Petr Ovtchenkov <ye...@ya...> * shm.h: condition_event_ip may be used in shared memory; Modified: trunk/complement/explore/lib/mt/Makefile.inc =================================================================== --- trunk/complement/explore/lib/mt/Makefile.inc 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/Makefile.inc 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,9 +1,9 @@ -# -*- Makefile -*- Time-stamp: <08/06/30 13:51:45 yeti> +# -*- Makefile -*- Time-stamp: <08/07/02 09:28:02 ptr> LIBNAME = xmt MAJOR = 2 MINOR = 0 -PATCH = 4 +PATCH = 5 SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc shm.cc callstack.cc system_error.cc thread.cc \ date_time.cc SRC_C = fl.c Modified: trunk/complement/explore/lib/mt/uid.cc =================================================================== --- trunk/complement/explore/lib/mt/uid.cc 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/uid.cc 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,7 +1,7 @@ -// -*- C++ -*- Time-stamp: <08/06/06 21:23:34 yeti> +// -*- C++ -*- Time-stamp: <08/07/02 08:56:16 ptr> /* - * Copyright (c) 2006 + * Copyright (c) 2006, 2008 * Petr Ovtchenkov * * Licensed under the Academic Free License version 3.0 @@ -10,10 +10,11 @@ #include <mt/uid.h> #include <mt/mutex> -#include <fstream> #include <sstream> #include <iomanip> #include <cstring> +#include <unistd.h> +#include <fcntl.h> namespace xmt { @@ -29,26 +30,28 @@ __uid_init(); static uuid_type _host_id; - static char _host_id_str[48]; // 37 really + char _host_id_str[48]; // 37 really }; uuid_type __uid_init::_host_id; -char __uid_init::_host_id_str[48]; -// ifstream _uuid; +struct __uuid_init +{ + public: + __uuid_init(); + ~__uuid_init(); + int fd; +}; + __uid_init::__uid_init() { - static mutex _lk; + int fd = ::open( "/proc/sys/kernel/random/boot_id", O_RDONLY ); - lock_guard<mutex> lock( _lk ); - ifstream f( "/proc/sys/kernel/random/boot_id" ); + ::read( fd, _host_id_str, 36 ); + _host_id_str[36] = '\0'; + ::close( fd ); - string tmp; - getline( f, tmp ); - strcpy( _host_id_str, tmp.c_str() ); - - stringstream s; s << _host_id_str[0] << _host_id_str[1] << ' ' << _host_id_str[2] << _host_id_str[3] << ' ' @@ -86,6 +89,16 @@ >> reinterpret_cast<unsigned&>(_host_id.u.b[15]); } +__uuid_init::__uuid_init() +{ + fd = ::open( "/proc/sys/kernel/random/uuid", O_RDONLY ); +} + +__uuid_init::~__uuid_init() +{ + ::close( fd ); +} + } // namespace detail using namespace std; @@ -94,7 +107,7 @@ const char *hostid_str() { static detail::__uid_init _uid; - return detail::__uid_init::_host_id_str; + return _uid._host_id_str; } const xmt::uuid_type& hostid() @@ -105,22 +118,13 @@ std::string uid_str() { - static mutex _lk; + static detail::__uuid_init __uuid; - lock_guard<mutex> lock( _lk ); + char buf[36]; - // if ( !detail::_uuid.is_open() ) { - // detail::_uuid.open( "/proc/sys/kernel/random/uuid" ); - // } + ::read( __uuid.fd, buf, 36 ); - ifstream _uuid( "/proc/sys/kernel/random/uuid" ); - - std::string tmp; - - // getline( detail::_uuid, tmp ).clear(); // clear eof bit - getline( _uuid, tmp ); - - return tmp; + return std::string( buf, 36 ); } xmt::uuid_type uid() Modified: trunk/complement/explore/lib/mt/ut/Makefile =================================================================== --- trunk/complement/explore/lib/mt/ut/Makefile 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/ut/Makefile 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,4 +1,4 @@ -# -*- Makefile -*- Time-stamp: <08/06/12 15:11:40 ptr> +# -*- Makefile -*- Time-stamp: <08/07/02 09:15:45 ptr> SRCROOT := ../../.. @@ -21,18 +21,18 @@ # endif LIBMT_DIR = ${CoMT_DIR}/lib/mt -# LIBUTF_DIR = ${CoMT_DIR}/../extern/custom/boost/libs/test/unit_test_framework LIBEXAM_DIR = ${CoMT_DIR}/lib/exam +LIBMISC_DIR = ${CoMT_DIR}/lib/misc LIBFS_DIR = ${CoMT_DIR}/../extern/custom/boost/libs/filesystem ifeq ($(OSNAME),linux) -release-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR} -L${LIBEXAM_DIR}/${OUTPUT_DIR} -L${LIBFS_DIR}/${OUTPUT_DIR} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR}:${LIBEXAM_DIR}/${OUTPUT_DIR}:${LIBFS_DIR}/${OUTPUT_DIR}:${STLPORT_LIB_DIR} +release-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR} -L${LIBEXAM_DIR}/${OUTPUT_DIR} -L${LIBFS_DIR}/${OUTPUT_DIR} -L${LIBMISC_DIR}/${OUTPUT_DIR} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR}:${LIBEXAM_DIR}/${OUTPUT_DIR}:${LIBFS_DIR}/${OUTPUT_DIR}:${LIBMISC_DIR}/${OUTPUT_DIR}:${STLPORT_LIB_DIR} -dbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_DBG} -L${LIBEXAM_DIR}/${OUTPUT_DIR_DBG} -L${LIBFS_DIR}/${OUTPUT_DIR_DBG} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_DBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_DBG}:${LIBFS_DIR}/${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} +dbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_DBG} -L${LIBEXAM_DIR}/${OUTPUT_DIR_DBG} -L${LIBFS_DIR}/${OUTPUT_DIR_DBG} -L${LIBMISC_DIR}/${OUTPUT_DIR_DBG} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_DBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_DBG}:${LIBFS_DIR}/${OUTPUT_DIR_DBG}:${LIBMISC_DIR}/${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} ifndef WITHOUT_STLPORT -stldbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_STLDBG} -L${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG} -L${LIBFS_DIR}/${OUTPUT_DIR_STLDBG} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_STLDBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG}:${LIBFS_DIR}/${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} +stldbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_STLDBG} -L${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG} -L${LIBFS_DIR}/${OUTPUT_DIR_STLDBG} -L${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_STLDBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG}:${LIBFS_DIR}/${OUTPUT_DIR_STLDBG}:${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} endif endif @@ -49,10 +49,10 @@ endif -release-shared : LDLIBS = -lxmt -lexam -lboost_fs -dbg-shared : LDLIBS = -lxmtg -lexamg -lboost_fsg +release-shared : LDLIBS = -lxmt -lexam -lmisc -lboost_fs +dbg-shared : LDLIBS = -lxmtg -lexamg -lmiscg -lboost_fsg ifndef WITHOUT_STLPORT -stldbg-shared : LDLIBS = -lxmtstlg -lexamstlg -lboost_fsstlg +stldbg-shared : LDLIBS = -lxmtstlg -lexamstlg -lmiscstlg -lboost_fsstlg endif ifeq ($(OSNAME),freebsd) Modified: trunk/complement/explore/lib/mt/ut/Makefile.inc =================================================================== --- trunk/complement/explore/lib/mt/ut/Makefile.inc 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/ut/Makefile.inc 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,7 +1,7 @@ -# -*- makefile -*- Time-stamp: <08/03/26 10:12:36 ptr> +# -*- makefile -*- Time-stamp: <08/07/02 09:03:03 ptr> PRGNAME = mt_ut -SRC_CC = unit_test.cc timespec.cc \ +SRC_CC = timespec.cc \ signal-1.cc signal-3.cc \ mt_test.cc shm_test.cc mt_test_suite.cc \ mt_test_wg21.cc Modified: trunk/complement/explore/lib/mt/ut/mt_test_suite.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_suite.cc 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/ut/mt_test_suite.cc 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/03/26 10:12:21 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 09:24:48 ptr> /* * Copyright (c) 2006-2008 @@ -15,6 +15,9 @@ #include <config/feature.h> +#include <misc/opts.h> +#include <string> + int EXAM_DECL(timespec_diff); int EXAM_DECL(signal_1_test); // int EXAM_DECL(signal_2_test); @@ -24,7 +27,7 @@ // int EXAM_DECL( flock_test ); // int EXAM_DECL( lfs_test ); -int EXAM_IMPL(mt_test_suite) +int main( int argc, const char** argv ) { exam::test_suite t( "libxmt test" ); mt_test test; @@ -75,7 +78,58 @@ t.add( &mt_test_wg21::barrier, test_wg21, "mt_test_wg21::barrier" ); t.add( &mt_test_wg21::semaphore, test_wg21, "mt_test_wg21::semaphore" ); t.add( &mt_test_wg21::fork, test_wg21, "mt_test_wg21::fork" ); - t.add( &mt_test_wg21::uid, test_wg21, "mt_test_wg21::uid" ); + uid_test_wg21 test_wg21_uid; + + t.add( &uid_test_wg21::uid, test_wg21_uid, "uid_test_wg21::uid" ); + t.add( &uid_test_wg21::hostid, test_wg21_uid, "uid_test_wg21::hostid" ); + + Opts opts; + + opts.description( "test suite for 'sockios' framework" ); + opts.usage( "[options]" ); + + opts << option<bool>( "print this help message", 'h', "help" ) + << option<bool>( "list all test cases", 'l', "list" ) + << option<std::string>( "run tests by number", 'r', "run" )["0"] + << option<bool>( "print status of tests within test suite", 'v', "verbose" ) + << option<bool>( "trace checks", 't', "trace" ); + + try { + opts.parse( argc, argv ); + } + catch (...) { + opts.help( std::cerr ); + return 1; + } + + if ( opts.is_set( 'h' ) ) { + opts.help( std::cerr ); + return 0; + } + + if ( opts.is_set( 'l' ) ) { + t.print_graph( std::cerr ); + return 0; + } + + if ( opts.is_set( 'v' ) ) { + t.flags( t.flags() | exam::base_logger::verbose ); + } + + if ( opts.is_set( 't' ) ) { + t.flags( t.flags() | exam::base_logger::trace ); + } + + if ( opts.is_set( 'r' ) ) { + std::stringstream ss( opts.get<std::string>( 'r' ) ); + int n; + while ( ss >> n ) { + t.single( n ); + } + + return 0; + } + return t.girdle(); }; Modified: trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/03/26 01:53:46 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 09:21:04 ptr> /* * Copyright (c) 2006-2008 @@ -318,18 +318,39 @@ return EXAM_RESULT; } -int EXAM_IMPL(mt_test_wg21::uid) +int EXAM_IMPL(uid_test_wg21::uid) { std::string u1 = xmt::uid_str(); EXAM_CHECK( !u1.empty() ); + EXAM_CHECK( u1.length() == 36 ); + std::string u2 = xmt::uid_str(); EXAM_CHECK( !u2.empty() ); + EXAM_CHECK( u2.length() == 36 ); + EXAM_CHECK( u1 != u2 ); return EXAM_RESULT; } +int EXAM_IMPL(uid_test_wg21::hostid) +{ + std::string u1 = xmt::hostid_str(); + + EXAM_CHECK( !u1.empty() ); + + EXAM_CHECK( u1.length() == 36 ); + + std::string u2 = xmt::hostid_str(); + + EXAM_CHECK( !u2.empty() ); + + EXAM_CHECK( u1 == u2 ); + + return EXAM_RESULT; +} + Modified: trunk/complement/explore/lib/mt/ut/mt_test_wg21.h =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_wg21.h 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/ut/mt_test_wg21.h 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/02/25 12:12:20 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 09:27:26 ptr> /* * Copyright (c) 2006-2008 @@ -14,7 +14,6 @@ #define FIT_EXAM #include <exam/suite.h> -// #include <mt/shm.h> class mt_test_wg21 { @@ -25,11 +24,17 @@ int EXAM_DECL(barrier); int EXAM_DECL(semaphore); int EXAM_DECL(fork); - int EXAM_DECL(uid); private: // static xmt::Thread::ret_t thread_entry_call( void * ); // static int x; }; +class uid_test_wg21 +{ + public: + int EXAM_DECL(uid); + int EXAM_DECL(hostid); +}; + #endif // __MT_TEST_WG21_H Modified: trunk/complement/explore/lib/mt/ut/shm_test.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/shm_test.cc 2008-07-02 05:36:21 UTC (rev 1938) +++ trunk/complement/explore/lib/mt/ut/shm_test.cc 2008-07-02 05:36:38 UTC (rev 1939) @@ -1,7 +1,7 @@ -// -*- C++ -*- Time-stamp: <08/03/26 10:11:58 ptr> +// -*- C++ -*- Time-stamp: <08/07/02 08:58:02 ptr> /* - * Copyright (c) 2006, 2007 + * Copyright (c) 2006-2008 * Petr Ovtchenkov * * Licensed under the Academic Free License Version 3.0 @@ -10,7 +10,7 @@ #include "shm_test.h" -#include <mt/xmt.h> +#include <mt/condition_variable> #include <mt/shm.h> @@ -188,27 +188,29 @@ seg.allocate( fname, 1024, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 ); xmt::allocator_shm<char,0> shm; - xmt::__condition<true>& fcnd = *new( shm.allocate( sizeof(xmt::__condition<true>) ) ) xmt::__condition<true>(); - fcnd.set( false ); + std::tr2::condition_event_ip& fcnd = *new( shm.allocate( sizeof(std::tr2::condition_event_ip) ) ) std::tr2::condition_event_ip(); + try { xmt::fork(); try { // Child code - fcnd.try_wait(); + if ( fcnd.timed_wait( std::tr2::milliseconds( 800 ) ) ) { + exit( 0 ); + } } catch ( ... ) { } - exit( 0 ); + exit( 1 ); } catch ( xmt::fork_in_parent& child ) { try { EXAM_CHECK( child.pid() > 0 ); - fcnd.set( true ); + fcnd.notify_one(); int stat = -1; EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); @@ -224,8 +226,8 @@ catch ( ... ) { } - (&fcnd)->~__condition<true>(); - shm.deallocate( reinterpret_cast<char *>(&fcnd), sizeof(xmt::__condition<true>) ); + (&fcnd)->~__condition_event<true>(); + shm.deallocate( reinterpret_cast<char *>(&fcnd), sizeof(std::tr2::condition_event_ip) ); seg.deallocate(); fs::remove( fname ); } @@ -251,11 +253,10 @@ seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 ); xmt::shm_name_mgr<0>& nm = seg.name_mgr(); - xmt::allocator_shm<xmt::__condition<true>,0> shm; + xmt::allocator_shm<std::tr2::condition_event_ip,0> shm; - xmt::__condition<true>& fcnd = *new ( shm.allocate( 1 ) ) xmt::__condition<true>(); + std::tr2::condition_event_ip& fcnd = *new ( shm.allocate( 1 ) ) std::tr2::condition_event_ip(); nm.named( fcnd, test_Condition_Object ); - fcnd.set( false ); try { xmt::fork(); @@ -276,8 +277,8 @@ } xmt::shm_name_mgr<0>& nm_ch = seg_ch.name_mgr(); - xmt::__condition<true>& fcnd_ch = nm_ch.named<xmt::__condition<true> >( test_Condition_Object ); - fcnd_ch.set( true ); + std::tr2::condition_event_ip& fcnd_ch = nm_ch.named<std::tr2::condition_event_ip>( test_Condition_Object ); + fcnd_ch.notify_one(); } catch ( const xmt::shm_bad_alloc& err ) { EXAM_ERROR_ASYNC_F( err.what(), eflag ); @@ -295,7 +296,7 @@ try { EXAM_CHECK( child.pid() > 0 ); - fcnd.try_wait(); + EXAM_CHECK( fcnd.timed_wait( std::tr2::milliseconds( 800 ) ) ); int stat = -1; EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); @@ -313,7 +314,7 @@ EXAM_ERROR( "Fail in fork" ); } - (&fcnd)->~__condition<true>(); + (&fcnd)->~__condition_event<true>(); shm.deallocate( &fcnd, 1 ); seg.deallocate(); fs::remove( fname ); @@ -359,11 +360,10 @@ try { xmt::shm_name_mgr<1>& nm = seg1.name_mgr(); - xmt::allocator_shm<xmt::__condition<true>,1> shm; + xmt::allocator_shm<std::tr2::condition_event_ip,1> shm; - xmt::__condition<true>& fcnd = *new ( shm.allocate( 1 ) ) xmt::__condition<true>(); + std::tr2::condition_event_ip& fcnd = *new ( shm.allocate( 1 ) ) std::tr2::condition_event_ip(); nm.named( fcnd, ObjName ); - fcnd.set( false ); try { xmt::fork(); @@ -372,10 +372,10 @@ try { xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); - xmt::allocator_shm<xmt::__condition<true>,1> shm_ch; - xmt::__condition<true>& fcnd_ch = nm_ch.named<xmt::__condition<true> >( ObjName ); - fcnd_ch.set( true ); - nm_ch.release<xmt::__condition<true> >( ObjName ); + xmt::allocator_shm<std::tr2::condition_event_ip,1> shm_ch; + std::tr2::condition_event_ip& fcnd_ch = nm_ch.named<std::tr2::condition_event_ip>( ObjName ); + fcnd_ch.notify_one(); + nm_ch.release<std::tr2::condition_event_ip>( ObjName ); } catch ( const std::invalid_argument& err ) { EXAM_ERROR_ASYNC_F( err.what(), eflag ); @@ -383,7 +383,7 @@ exit( eflag ); } catch ( xmt::fork_in_parent& child ) { - fcnd.try_wait(); + EXAM_CHECK( fcnd.timed_wait( std::tr2::milliseconds( 800 ) ) ); int stat = -1; EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); if ( WIFEXITED(stat) ) { @@ -392,11 +392,10 @@ EXAM_ERROR( "child interrupted" ); } } - nm.release<xmt::__condition<true> >( ObjName ); // fcnd should be destroyed here + nm.release<std::tr2::condition_event_ip>( ObjName ); // fcnd should be destroyed here - xmt::__condition<true>& fcnd1 = *new ( shm.allocate( 1 ) ) xmt::__condition<true>(); + std::tr2::condition_event_ip& fcnd1 = *new ( shm.allocate( 1 ) ) std::tr2::condition_event_ip(); nm.named( fcnd1, ObjName ); // ObjName should be free here - fcnd1.set( false ); try { xmt::fork(); @@ -405,10 +404,10 @@ try { xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); - xmt::allocator_shm<xmt::__condition<true>,1> shm_ch; - xmt::__condition<true>& fcnd_ch = nm_ch.named<xmt::__condition<true> >( ObjName ); - fcnd_ch.set( true ); - nm_ch.release<xmt::__condition<true> >( ObjName ); + xmt::allocator_shm<std::tr2::condition_event_ip,1> shm_ch; + std::tr2::condition_event_ip& fcnd_ch = nm_ch.named<std::tr2::condition_event_ip>( ObjName ); + fcnd_ch.notify_one(); + nm_ch.release<std::tr2::condition_event_ip>( ObjName ); } catch ( const std::invalid_argument& err ) { EXAM_ERROR_ASYNC_F( err.what(), eflag ); @@ -417,7 +416,7 @@ exit( eflag ); } catch ( xmt::fork_in_parent& child ) { - fcnd1.try_wait(); + EXAM_CHECK( fcnd1.timed_wait( std::tr2::milliseconds( 800 ) ) ); int stat = -1; EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); if ( WIFEXITED(stat) ) { @@ -426,10 +425,10 @@ EXAM_ERROR( "child interrupted" ); } } - nm.release<xmt::__condition<true> >( ObjName ); // fcnd should be destroyed here + nm.release<std::tr2::condition_event_ip>( ObjName ); // fcnd should be destroyed here - xmt::allocator_shm<xmt::__barrier<true>,1> shm_b; - xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); + xmt::allocator_shm<std::tr2::barrier_ip,1> shm_b; + std::tr2::barrier_ip& b = *new ( shm_b.allocate( 1 ) ) std::tr2::barrier_ip(); nm.named( b, ObjName ); // ObjName should be free here @@ -439,10 +438,10 @@ int eflag = 0; try { xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); - xmt::allocator_shm<xmt::__barrier<true>,1> shm_ch; - xmt::__barrier<true>& b_ch = nm_ch.named<xmt::__barrier<true> >( ObjName ); + xmt::allocator_shm<std::tr2::barrier_ip,1> shm_ch; + std::tr2::barrier_ip& b_ch = nm_ch.named<std::tr2::barrier_ip>( ObjName ); b_ch.wait(); - nm_ch.release<xmt::__barrier<true> >( ObjName ); + nm_ch.release<std::tr2::barrier_ip>( ObjName ); } catch ( const std::invalid_argument& err ) { EXAM_ERROR_ASYNC_F( err.what(), eflag ); @@ -460,7 +459,7 @@ EXAM_ERROR( "child interrupted" ); } } - nm.release<xmt::__barrier<true> >( ObjName ); // barrier should be destroyed here + nm.release<std::tr2::barrier_ip>( ObjName ); // barrier should be destroyed here } catch ( xmt::shm_bad_alloc& err ) { EXAM_ERROR( err.what() ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |