[complement-svn] SF.net SVN: complement: [1604] branches/complement-xmt/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-07-11 18:52:50
|
Revision: 1604 http://svn.sourceforge.net/complement/?rev=1604&view=rev Author: complement Date: 2007-07-11 11:52:43 -0700 (Wed, 11 Jul 2007) Log Message: ----------- Barrier replaced by barrier, Semaphore by semaphore Modified Paths: -------------- branches/complement-xmt/explore/include/mt/shm.h branches/complement-xmt/explore/include/mt/xmt.h branches/complement-xmt/explore/lib/mt/ChangeLog branches/complement-xmt/explore/test/mt/mt_test.cc branches/complement-xmt/explore/test/sockios/sockios_test.cc Modified: branches/complement-xmt/explore/include/mt/shm.h =================================================================== --- branches/complement-xmt/explore/include/mt/shm.h 2007-07-11 17:56:00 UTC (rev 1603) +++ branches/complement-xmt/explore/include/mt/shm.h 2007-07-11 18:52:43 UTC (rev 1604) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/11 20:52:38 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 22:38:41 ptr> /* * Copyright (c) 2006, 2007 @@ -76,13 +76,13 @@ }; template <> -struct ipc_sharable<xmt::__Semaphore<true> > +struct ipc_sharable<xmt::__semaphore<true> > { typedef std::__true_type is_ipc_sharable; }; template <> -struct ipc_sharable<xmt::__Barrier<true> > +struct ipc_sharable<xmt::__barrier<true> > { typedef std::__true_type is_ipc_sharable; }; Modified: branches/complement-xmt/explore/include/mt/xmt.h =================================================================== --- branches/complement-xmt/explore/include/mt/xmt.h 2007-07-11 17:56:00 UTC (rev 1603) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-07-11 18:52:43 UTC (rev 1604) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/11 20:51:27 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 22:37:57 ptr> /* * Copyright (c) 1997-1999, 2002-2007 @@ -1161,10 +1161,10 @@ typedef __condition<false> condition; template <bool SCOPE> -class __Semaphore +class __semaphore { public: - __Semaphore( int cnt = 1 ) + __semaphore( int cnt = 1 ) { #ifdef __FIT_WIN32THREADS _sem = CreateSemaphore( NULL, cnt, INT_MAX, 0 ); // check! @@ -1178,7 +1178,7 @@ #endif } - ~__Semaphore() + ~__semaphore() { #ifdef __FIT_WIN32THREADS CloseHandle( _sem ); @@ -1270,14 +1270,14 @@ sem_t _sem; #endif private: - __Semaphore( const __Semaphore& ) + __semaphore( const __semaphore& ) { } }; -typedef __Semaphore<false> Semaphore; +typedef __semaphore<false> semaphore; template <bool SCOPE> -int __Semaphore<SCOPE>::wait_time( const ::timespec *abstime ) // wait for time t, or signal +int __semaphore<SCOPE>::wait_time( const ::timespec *abstime ) // wait for time t, or signal { #ifdef __FIT_WIN32THREADS time_t ct = time( 0 ); @@ -1303,7 +1303,7 @@ } template <bool SCOPE> -int __Semaphore<SCOPE>::wait_delay( const ::timespec *interval ) // wait, timeout is delay t, or signal +int __semaphore<SCOPE>::wait_delay( const ::timespec *interval ) // wait, timeout is delay t, or signal { #ifdef __FIT_WIN32THREADS unsigned ms = interval->tv_sec * 1000 + interval->tv_nsec / 1000000; @@ -1329,10 +1329,10 @@ } template <bool SCOPE> -class __Barrier +class __barrier { public: - __Barrier( unsigned cnt = 2 ) + __barrier( unsigned cnt = 2 ) { #ifdef _PTHREADS pthread_barrierattr_t attr; @@ -1343,7 +1343,7 @@ #endif } - ~__Barrier() + ~__barrier() { #ifdef _PTHREADS pthread_barrier_destroy( &_barr ); @@ -1363,7 +1363,7 @@ #endif }; -typedef __Barrier<false> Barrier; +typedef __barrier<false> barrier; __FIT_DECLSPEC void fork() throw( fork_in_parent, std::runtime_error ); __FIT_DECLSPEC void become_daemon() throw( fork_in_parent, std::runtime_error ); Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-07-11 17:56:00 UTC (rev 1603) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-07-11 18:52:43 UTC (rev 1604) @@ -1,7 +1,9 @@ 2007-07-11 Petr Ovtchenkov <pt...@is...> - * xmt.h, shm.h: Condition replaced by condition. + * xmt.h, shm.h: Condition replaced by condition; + * xmt.h, shm.h: Barrier replaced by barrier, Semaphore by semaphore. + 2007-06-29 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc, uid.cc, thr_mgr.cc: replace Locker by scoped_lock. Modified: branches/complement-xmt/explore/test/mt/mt_test.cc =================================================================== --- branches/complement-xmt/explore/test/mt/mt_test.cc 2007-07-11 17:56:00 UTC (rev 1603) +++ branches/complement-xmt/explore/test/mt/mt_test.cc 2007-07-11 18:52:43 UTC (rev 1604) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/11 21:25:32 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 22:08:56 ptr> /* * Copyright (c) 2006, 2007 @@ -37,7 +37,7 @@ */ void mt_test::barrier() { - xmt::Barrier b( 1 ); + xmt::barrier b( 1 ); b.wait(); } @@ -78,7 +78,7 @@ xmt::Thread::ret_code rt; rt.iword = 0; - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); return rt; @@ -86,7 +86,7 @@ void mt_test::barrier2() { - xmt::Barrier b; + xmt::barrier b; xmt::Thread t1( thread2_entry_call, &b ); xmt::Thread t2( thread2_entry_call, &b ); @@ -105,7 +105,7 @@ xmt::Thread::ret_code rt; rt.iword = 0; - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); BOOST_CHECK( xmt::Thread::yield() == 0 ); @@ -114,7 +114,7 @@ void mt_test::yield() { - xmt::Barrier b; + xmt::barrier b; xmt::Thread t1( thread2_entry_call, &b ); xmt::Thread t2( thread3_entry_call, &b ); @@ -135,7 +135,7 @@ xmt::Thread::ret_code thr1( void *p ) { - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); m1.lock(); @@ -156,7 +156,7 @@ xmt::Thread::ret_code thr2( void *p ) { - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); for ( int i = 0; i < 128; ++i ) { xmt::Thread::yield(); @@ -176,7 +176,7 @@ void mt_test::mutex_test() { x = 0; - xmt::Barrier b; + xmt::barrier b; xmt::Thread t1( thr1, &b ); xmt::Thread t2( thr2, &b ); @@ -202,7 +202,7 @@ xmt::Thread::ret_code thr1s( void *p ) { - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); sl1.lock(); @@ -223,7 +223,7 @@ xmt::Thread::ret_code thr2s( void *p ) { - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); for ( int i = 0; i < 128; ++i ) { xmt::Thread::yield(); @@ -246,7 +246,7 @@ { #ifdef __FIT_PTHREAD_SPINLOCK x = 0; - xmt::Barrier b; + xmt::barrier b; xmt::Thread t1( thr1s, &b ); xmt::Thread t2( thr2s, &b ); @@ -302,7 +302,7 @@ xmt::Thread::ret_code thr1r( void *p ) { - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); m2.lock(); @@ -326,7 +326,7 @@ xmt::Thread::ret_code thr2r( void *p ) { - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); for ( int i = 0; i < 128; ++i ) { @@ -352,7 +352,7 @@ void mt_test::recursive_mutex_test() { x = 0; - xmt::Barrier b; + xmt::barrier b; xmt::Thread t1( thr1r, &b ); xmt::Thread t2( thr2r, &b ); @@ -849,8 +849,8 @@ } nm.release<xmt::__condition<true> >( 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<xmt::__barrier<true>,1> shm_b; + xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); nm.named( b, ObjName ); // ObjName should be free here @@ -859,10 +859,10 @@ 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<xmt::__barrier<true>,1> shm_ch; + xmt::__barrier<true>& b_ch = nm_ch.named<xmt::__barrier<true> >( ObjName ); b_ch.wait(); - nm_ch.release<xmt::__Barrier<true> >( ObjName ); + nm_ch.release<xmt::__barrier<true> >( ObjName ); } catch ( const std::invalid_argument& err ) { BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); @@ -875,7 +875,7 @@ int stat; BOOST_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); } - nm.release<xmt::__Barrier<true> >( ObjName ); // barrier should be destroyed here + nm.release<xmt::__barrier<true> >( ObjName ); // barrier should be destroyed here } catch ( xmt::shm_bad_alloc& err ) { BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); Modified: branches/complement-xmt/explore/test/sockios/sockios_test.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-07-11 17:56:00 UTC (rev 1603) +++ branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-07-11 18:52:43 UTC (rev 1604) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/11 21:40:23 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 22:33:49 ptr> /* * @@ -27,7 +27,7 @@ const char fname[] = "/tmp/sockios_test.shm"; xmt::shm_alloc<0> seg; xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; -xmt::allocator_shm<xmt::__Barrier<true>,0> shm_b; +xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; sockios_test::sockios_test() { @@ -200,7 +200,7 @@ fill( buf, buf + 1024, 0 ); - xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); + xmt::barrier& b = *reinterpret_cast<xmt::barrier *>(p); b.wait(); while( true ) { @@ -245,7 +245,7 @@ * so I don't care about safe termination. */ const int b_count = 10; - xmt::Barrier b( b_count ); + xmt::barrier b( b_count ); xmt::Thread *th1 = new xmt::Thread( client_thr, &b ); for ( int i = 0; i < (b_count - 1); ++i ) { @@ -432,11 +432,11 @@ void connect( std::sockstream& ); void close(); - static xmt::__Barrier<true> *b; + static xmt::__barrier<true> *b; }; -xmt::__Barrier<true> *ConnectionProcessor5::b = 0; +xmt::__barrier<true> *ConnectionProcessor5::b = 0; ConnectionProcessor5::ConnectionProcessor5( std::sockstream& s ) { @@ -490,7 +490,7 @@ { try { xmt::__condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); - xmt::__Barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__Barrier<true>(); + xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); ConnectionProcessor5::b = &b; // nm.named( fcnd, 1 ); fcnd.set( false ); @@ -530,7 +530,7 @@ srv.wait(); } - (&b)->~__Barrier<true>(); + (&b)->~__barrier<true>(); shm_b.deallocate( &b, 1 ); (&fcnd)->~__condition<true>(); shm_cnd.deallocate( &fcnd, 1 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |