Thread: [complement-svn] SF.net SVN: complement: [1586] branches/complement-xmt/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-06-14 06:47:35
|
Revision: 1586 http://svn.sourceforge.net/complement/?rev=1586&view=rev Author: complement Date: 2007-06-13 23:47:19 -0700 (Wed, 13 Jun 2007) Log Message: ----------- step to interface like boost or http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2007/n2178.html; Locker* changed to basic_lock or basic_read_lock, internal lock flag added, lock/unlock methods added to basic_*_lock and exception lock_error added too. 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/lib/mt/xmt.cc Modified: branches/complement-xmt/explore/include/mt/shm.h =================================================================== --- branches/complement-xmt/explore/include/mt/shm.h 2007-06-08 19:40:15 UTC (rev 1585) +++ branches/complement-xmt/explore/include/mt/shm.h 2007-06-14 06:47:19 UTC (rev 1586) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/02/07 10:11:34 ptr> +// -*- C++ -*- Time-stamp: <07/06/14 10:16:59 ptr> /* * Copyright (c) 2006, 2007 @@ -303,7 +303,7 @@ template <class T> void named( const T& obj, int name ) { - xmt::__Locker<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__Mutex<false,true> > lk( _lock ); if ( _last == 255 ) { throw std::range_error( "too many named objects" ); } @@ -328,7 +328,7 @@ template <class T> T& named( int name ) { - xmt::__Locker<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__Mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { ++_nm_table[i].count; @@ -341,7 +341,7 @@ template <class T> const T& named( int name ) const { - xmt::__Locker<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__Mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { ++_nm_table[i].count; @@ -354,7 +354,7 @@ template <class T> void release( int name ) { - xmt::__Locker<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__Mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { if ( --_nm_table[i].count == 0 ) { @@ -371,7 +371,7 @@ int count( int name ) const throw() { - xmt::__Locker<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__Mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { return _nm_table[i].count; @@ -480,7 +480,7 @@ if ( p != reinterpret_cast<pointer>(-1) ) { _master *m = reinterpret_cast<_master *>( p ); if ( m->_nm == 0 ) { - xmt::__Locker<xmt::__Mutex<false,true> > lk( m->_lock ); + xmt::basic_lock<xmt::__Mutex<false,true> > lk( m->_lock ); void *nm = _traverse( &m->_first, sizeof(shm_name_mgr<_Inst>) ); m->_nm = reinterpret_cast<char *>(nm) - reinterpret_cast<char *>(p); return *new ( nm ) shm_name_mgr<_Inst>(); @@ -496,7 +496,7 @@ { _master *m = reinterpret_cast<_master *>( _seg.address() ); if ( m != reinterpret_cast<_master *>(-1) ) { - xmt::__Locker<xmt::__Mutex<false,true> > lk( m->_lock ); + xmt::basic_lock<xmt::__Mutex<false,true> > lk( m->_lock ); return _traverse( &m->_first, n ); } @@ -513,7 +513,7 @@ { m._magic = MAGIC; new ( &m._lock ) xmt::__Mutex<false,true>(); - xmt::__Locker<xmt::__Mutex<false,true> > lk( m._lock ); + xmt::basic_lock<xmt::__Mutex<false,true> > lk( m._lock ); m._first = sizeof( _master ); m._nm = 0; _fheader& h = *new ( reinterpret_cast<char *>(&m) + sizeof(_master) ) _fheader(); @@ -535,7 +535,7 @@ n = max( n + (__align - n % __align) % __align, sizeof(_fheader) ); _master *m = reinterpret_cast<_master *>( _seg.address() ); if ( m != reinterpret_cast<_master *>(-1) && (reinterpret_cast<char *>(p) - reinterpret_cast<char *>(_seg.address())) < (_seg.max_size() + sizeof(_master) + sizeof(_aheader) ) ) { - xmt::__Locker<xmt::__Mutex<false,true> > lk( m->_lock ); + xmt::basic_lock<xmt::__Mutex<false,true> > lk( m->_lock ); _aheader *a = reinterpret_cast<_aheader *>( reinterpret_cast<char *>(p) - sizeof(_aheader) ); size_type off = reinterpret_cast<char *>(p) - reinterpret_cast<char *>(_seg.address()); if ( m->_first == 0 ) { Modified: branches/complement-xmt/explore/include/mt/xmt.h =================================================================== --- branches/complement-xmt/explore/include/mt/xmt.h 2007-06-08 19:40:15 UTC (rev 1585) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-06-14 06:47:19 UTC (rev 1586) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/03/12 20:09:11 ptr> +// -*- C++ -*- Time-stamp: <07/06/14 10:15:07 ptr> /* * Copyright (c) 1997-1999, 2002-2007 @@ -121,6 +121,32 @@ namespace xmt { + +// Exceptions + +// class thread_exit; +// class thread_cancel: public thread_exit; +// class thread_error: public exception; + +class lock_error : + public std::exception +{ + private: + int r_; + + public: + + explicit lock_error( int r ) : + r_( r ) + { } + + virtual char const *what() throw() + { return "std::lock_error"; } + + int error() const + { return r_; } +}; + namespace detail { #ifdef __FIT_PSHARED_MUTEX @@ -321,7 +347,7 @@ } #if !defined( WIN32 ) || (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400) - int trylock() + int try_lock() { #ifdef _PTHREADS return pthread_mutex_trylock( &this->_M_lock ); @@ -384,7 +410,7 @@ # endif } - int trylock() + int try_lock() { # ifdef _PTHREADS return pthread_spin_trylock( &this->_M_lock ); @@ -434,7 +460,7 @@ # endif // !_NOTHREADS } - int trylock() + int try_lock() { # ifdef _NOTHREADS return 0; @@ -549,11 +575,11 @@ // Equivalent to lock(), except that if the mutex object referenced // by mutex is currently locked the call return immediately. // If mutex is currently owned by the calling thread, the mutex lock count - // incremented by one and the trylock() function immediately return success + // incremented by one and the try_lock() function immediately return success // (value 0). Otherwise, if mutex is currently owned by another thread, // return error (non-zero). - int trylock() + int try_lock() { # ifdef _NOTHREADS return 0; @@ -718,7 +744,7 @@ #endif } - void wrlock() + void lock() { #ifdef _PTHREADS pthread_rwlock_wrlock( &this->_M_lock ); @@ -734,7 +760,7 @@ } #if !defined( WIN32 ) || (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400) - int tryrdlock() + int try_rdlock() { #ifdef _PTHREADS return pthread_rwlock_tryrdlock( &this->_M_lock ); @@ -753,7 +779,7 @@ #endif } - int trywrlock() + int try_lock() { #ifdef _PTHREADS return pthread_rwlock_trywrlock( &this->_M_lock ); @@ -797,52 +823,82 @@ #endif // __FIT_RWLOCK template <class M> -class __Locker +class basic_lock { public: - __Locker( const M& point ) : - m( point ) - { const_cast<M&>(m).lock(); } - ~__Locker() - { const_cast<M&>(m).unlock(); } + basic_lock( const M& point, bool initially_locked = true ) : + m( point ), + lk( false ) + { if ( initially_locked ) lock(); } + ~basic_lock() + { if ( lk ) const_cast<M&>(m).unlock(); } + void lock() + { + if ( lk ) { + throw lock_error( 0 ); + } + const_cast<M&>(m).lock(); + lk = true; + } + + void unlock() + { + if ( !lk ) { + throw lock_error( 0 ); + } + lk = false; + const_cast<M&>(m).unlock(); + } + private: - __Locker( const __Locker& ) + basic_lock( const basic_lock& ) { } + basic_lock& operator =( const basic_lock& ) + { return *this; } + const M& m; + bool lk; }; #ifdef __FIT_RWLOCK -template <bool SCOPE> -class __LockerRd +template <class M> +class basic_read_lock { public: - __LockerRd( const __MutexRW<SCOPE>& point ) : - m( point ) - { const_cast<__MutexRW<SCOPE>&>(m).rdlock(); } - ~__LockerRd() - { const_cast<__MutexRW<SCOPE>&>(m).unlock(); } + basic_read_lock( const M& point, bool initially_locked = true ) : + m( point ), + lk( false ) + { if ( initially_locked ) lock(); } + ~basic_read_lock() + { if ( lk ) const_cast<M&>(m).unlock(); } - private: - __LockerRd( const __LockerRd& ) - { } - const __MutexRW<SCOPE>& m; -}; + void lock() + { + if ( lk ) { + throw lock_error( 0 ); + } + const_cast<M&>(m).rdlock(); + lk = true; + } -template <bool SCOPE> -class __LockerWr -{ - public: - __LockerWr( const __MutexRW<SCOPE>& point ) : - m( point ) - { const_cast<__MutexRW<SCOPE>&>(m).wrlock(); } - ~__LockerWr() - { const_cast<__MutexRW<SCOPE>&>(m).unlock(); } + void unlock() + { + if ( !lk ) { + throw lock_error( 0 ); + } + lk = false; + const_cast<M&>(m).unlock(); + } private: - __LockerWr( const __LockerWr& ) + basic_read_lock( const basic_read_lock& ) { } - const __MutexRW<SCOPE>& m; + basic_read_lock& operator =( const basic_read_lock& ) + { return *this; } + + const M& m; + bool lk; }; #endif // __FIT_RWLOCK @@ -857,16 +913,17 @@ typedef __Spinlock<true,false> SpinlockRS; #endif // __FIT_RWLOCK -typedef __Locker<Mutex> Locker; -typedef __Locker<MutexRS> LockerRS; -typedef __Locker<MutexRS> LockerSDS; // obsolete, use instead LockerRS +typedef basic_lock<Mutex> Locker; +typedef basic_lock<Mutex> scoped_lock; +typedef basic_lock<MutexRS> LockerRS; +typedef basic_lock<MutexRS> LockerSDS; // obsolete, use instead LockerRS #ifdef __FIT_RWLOCK -typedef __LockerRd<false> LockerRd; -typedef __LockerWr<false> LockerWr; +typedef basic_read_lock<__MutexRW<false> > LockerRd; +typedef basic_lock<__MutexRW<false> > LockerWr; #endif // __FIT_RWLOCK #ifdef __FIT_PTHREAD_SPINLOCK -typedef __Locker<Spinlock> LockerSpin; -typedef __Locker<SpinlockRS> LockerSpinRS; +typedef basic_lock<Spinlock> LockerSpin; +typedef basic_lock<SpinlockRS> LockerSpinRS; #endif // __FIT_RWLOCK class LockerExt @@ -963,7 +1020,7 @@ bool set( bool __v, bool _broadcast = false ) { - __Locker<__Mutex<false,SCOPE> > _x1( _lock ); + basic_lock<__Mutex<false,SCOPE> > _x1( _lock ); bool tmp = _val; _val = __v; @@ -1004,7 +1061,7 @@ _lock.lock(); #endif #if defined(__FIT_UITHREADS) || defined(_PTHREADS) - __Locker<__Mutex<false,SCOPE> > _x1( _lock ); + basic_lock<__Mutex<false,SCOPE> > _x1( _lock ); #endif if ( _val == false ) { #ifdef __FIT_WIN32THREADS @@ -1047,7 +1104,7 @@ return 0; #endif #if defined(_PTHREADS) || defined(__FIT_UITHREADS) - __Locker<__Mutex<false,SCOPE> > lk( _lock ); + basic_lock<__Mutex<false,SCOPE> > lk( _lock ); _val = false; int ret; while ( !_val ) { @@ -1085,7 +1142,7 @@ int signal( bool _broadcast = false ) { - __Locker<__Mutex<false,SCOPE> > _x1( _lock ); + basic_lock<__Mutex<false,SCOPE> > _x1( _lock ); _val = true; #ifdef __FIT_WIN32THREADS Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-08 19:40:15 UTC (rev 1585) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-14 06:47:19 UTC (rev 1586) @@ -1,3 +1,11 @@ +2007-06-14 Petr Ovtchenkov <pt...@is...> + + * xmt.h, xmt.cc, shm.h: step to interface like boost or + http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2007/n2178.html; + Locker* changed to basic_lock or basic_read_lock, internal lock flag + added, lock/unlock methods added to basic_*_lock and exception + lock_error added too. + 2007-03-12 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc: code for Novell NetWare removed. Modified: branches/complement-xmt/explore/lib/mt/xmt.cc =================================================================== --- branches/complement-xmt/explore/lib/mt/xmt.cc 2007-06-08 19:40:15 UTC (rev 1585) +++ branches/complement-xmt/explore/lib/mt/xmt.cc 2007-06-14 06:47:19 UTC (rev 1586) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/03/12 20:14:35 ptr> +// -*- C++ -*- Time-stamp: <07/06/14 10:10:54 ptr> /* * Copyright (c) 1997-1999, 2002-2007 @@ -926,7 +926,7 @@ int Thread::xalloc() { - Locker _l( _idx_lock ); + scoped_lock _l( _idx_lock ); return _idx++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-06-29 09:52:20
|
Revision: 1587 http://svn.sourceforge.net/complement/?rev=1587&view=rev Author: complement Date: 2007-06-29 02:52:17 -0700 (Fri, 29 Jun 2007) Log Message: ----------- replace Locker by scoped_lock Modified Paths: -------------- branches/complement-xmt/explore/include/mt/xmt.h branches/complement-xmt/explore/include/sockios/sockmgr.cc branches/complement-xmt/explore/lib/mt/ChangeLog branches/complement-xmt/explore/lib/mt/thr_mgr.cc branches/complement-xmt/explore/lib/mt/uid.cc branches/complement-xmt/explore/lib/sockios/ChangeLog branches/complement-xmt/explore/lib/stem/ChangeLog branches/complement-xmt/explore/lib/stem/EvManager.cc branches/complement-xmt/explore/lib/stem/NetTransport.cc branches/complement-xmt/explore/test/sockios/sockios_test.cc Modified: branches/complement-xmt/explore/include/mt/xmt.h =================================================================== --- branches/complement-xmt/explore/include/mt/xmt.h 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 09:52:17 UTC (rev 1587) @@ -56,7 +56,7 @@ #ifdef _REENTRANT -# define MT_REENTRANT(point,nm) xmt::Locker nm(point) +# define MT_REENTRANT(point,nm) xmt::scoped_lock nm(point) # define MT_REENTRANT_RS(point,nm) xmt::LockerRS nm(point) # define MT_REENTRANT_SDS(point,nm) xmt::LockerSDS nm(point) // obsolete, use MT_REENTRANT_RS # define MT_LOCK(point) point.lock() @@ -913,7 +913,6 @@ typedef __Spinlock<true,false> SpinlockRS; #endif // __FIT_RWLOCK -typedef basic_lock<Mutex> Locker; typedef basic_lock<Mutex> scoped_lock; typedef basic_lock<MutexRS> LockerRS; typedef basic_lock<MutexRS> LockerSDS; // obsolete, use instead LockerRS @@ -1567,7 +1566,7 @@ MT_LOCK( _lock ); #endif #if defined(__FIT_UITHREADS) || defined(_PTHREADS) - MT_REENTRANT( _lock, _x1 ); + scoped_lock _x1( _lock ); #endif if ( _val == false ) { #ifdef __FIT_WIN32THREADS @@ -1623,7 +1622,7 @@ MT_LOCK( _lock ); #endif #if defined(__FIT_UITHREADS) || defined(_PTHREADS) - MT_REENTRANT( _lock, _x1 ); + scoped_lock _x1( _lock ); #endif if ( _val == false ) { #ifdef WIN32 @@ -1699,7 +1698,7 @@ return 0; #endif #ifdef _PTHREADS - MT_REENTRANT( _lock, _x1 ); // ?? + scoped_lock _x1( _lock ); // ?? _val = false; int ret = pthread_cond_timedwait( &_cond, &_lock._M_lock, abstime ); if ( ret == ETIMEDOUT ) { @@ -1708,7 +1707,7 @@ return ret; #endif // _PTHREADS #ifdef __FIT_UITHREADS - MT_REENTRANT( _lock, _x1 ); + scoped_lock _x1( _lock ); _val = false; int ret; while ( !_val ) { Modified: branches/complement-xmt/explore/include/sockios/sockmgr.cc =================================================================== --- branches/complement-xmt/explore/include/sockios/sockmgr.cc 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/include/sockios/sockmgr.cc 2007-06-29 09:52:17 UTC (rev 1587) @@ -100,7 +100,7 @@ // cerr << __FILE__ << ":" << __LINE__ << endl; // } if ( j->revents != 0 ) { - xmt::Locker _l( _c_lock ); + xmt::scoped_lock _l( _c_lock ); // We should distinguish closed socket from income message typename container_type::iterator i = find_if( _M_c.begin(), _M_c.end(), bind2nd( _M_comp, j->fd ) ); @@ -217,7 +217,7 @@ } try { - xmt::Locker _l( _c_lock ); + xmt::scoped_lock _l( _c_lock ); _M_c.push_back( _Connect() ); _M_c.back().open( _sd, addr.any ); _Connect *cl_new = &_M_c.back(); @@ -418,7 +418,7 @@ me->_conn_pool.erase( std::remove( me->_conn_pool.begin(), me->_conn_pool.end(), c ), me->_conn_pool.end() ); me->_dlock.unlock(); - xmt::Locker _l( me->_c_lock ); + xmt::scoped_lock _l( me->_c_lock ); me->_M_c.erase( c ); } } Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 09:52:17 UTC (rev 1587) @@ -1,3 +1,7 @@ +2007-06-29 Petr Ovtchenkov <pt...@is...> + + * xmt.h, xmt.cc, uid.cc, thr_mgr.cc: replace Locker by scoped_lock. + 2007-06-14 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc, shm.h: step to interface like boost or Modified: branches/complement-xmt/explore/lib/mt/thr_mgr.cc =================================================================== --- branches/complement-xmt/explore/lib/mt/thr_mgr.cc 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/lib/mt/thr_mgr.cc 2007-06-29 09:52:17 UTC (rev 1587) @@ -121,7 +121,7 @@ __FIT_DECLSPEC void ThreadMgr::launch( Thread::entrance_type entrance, const void *p, size_t psz, unsigned flags, size_t stack_sz ) { - Locker lk( _lock ); + scoped_lock lk( _lock ); _M_c.erase( remove_if( _M_c.begin(), _M_c.end(), rm_if_bad_thread() ), _M_c.end() ); // Thread *t = new Thread( entrance, p, psz, flags, stack_sz ); // cerr << (void *)t << " created\n"; @@ -132,13 +132,13 @@ __FIT_DECLSPEC void ThreadMgr::garbage_collector() { - Locker lk( _lock ); + scoped_lock lk( _lock ); _M_c.erase( remove_if( _M_c.begin(), _M_c.end(), rm_if_bad_thread() ), _M_c.end() ); } ThreadMgr::container_type::size_type ThreadMgr::size() const { - Locker lk( _lock ); + scoped_lock lk( _lock ); // ThreadMgr::container_type::size_type sz = count_if( _M_c.begin(), _M_c.end(), good_thread() ); // cerr << "Sz: " << sz << endl; @@ -148,7 +148,7 @@ __FIT_DECLSPEC void ThreadMgr::signal( int sig ) { // cerr << "Signal!" << endl; - Locker lk( _lock ); + scoped_lock lk( _lock ); for_each( _M_c.begin(), _M_c.end(), bind2nd( thread_signal(), sig ) ); } Modified: branches/complement-xmt/explore/lib/mt/uid.cc =================================================================== --- branches/complement-xmt/explore/lib/mt/uid.cc 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/lib/mt/uid.cc 2007-06-29 09:52:17 UTC (rev 1587) @@ -38,7 +38,7 @@ { static Mutex _lk; - Locker lock( _lk ); + scoped_lock lock( _lk ); ifstream f( "/proc/sys/kernel/random/boot_id" ); string tmp; Modified: branches/complement-xmt/explore/lib/sockios/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/sockios/ChangeLog 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/lib/sockios/ChangeLog 2007-06-29 09:52:17 UTC (rev 1587) @@ -1,3 +1,7 @@ +2007-06-29 Petr Ovtchenkov <pt...@is...> + + * sockmgr.cc, sockios_test.cc: replace Locker by scoped_lock. + 2007-02-12 Petr Ovtchenkov <pt...@is...> * sockmgr.h, _sockmgr.cc: use Init technique to initialize Modified: branches/complement-xmt/explore/lib/stem/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/stem/ChangeLog 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/lib/stem/ChangeLog 2007-06-29 09:52:17 UTC (rev 1587) @@ -1,3 +1,7 @@ +2007-06-29 Petr Ovtchenkov <pt...@is...> + + * NetTransport.cc, EvManager.cc: replace Locker by scoped_lock. + 2007-03-12 Petr Ovtchenkov <pt...@is...> * EvManager.h, EvManager.cc: trace-related locks, flags and Modified: branches/complement-xmt/explore/lib/stem/EvManager.cc =================================================================== --- branches/complement-xmt/explore/lib/stem/EvManager.cc 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/lib/stem/EvManager.cc 2007-06-29 09:52:17 UTC (rev 1587) @@ -111,19 +111,19 @@ { addr_type id; { - Locker lk( _lock_heap ); + scoped_lock lk( _lock_heap ); id = create_unique(); heap[id] = object; } { - Locker lk( _lock_xheap ); + scoped_lock lk( _lock_xheap ); gaddr_type& gaddr = _ex_heap[id]; gaddr.hid = xmt::hostid(); gaddr.pid = xmt::getpid(); gaddr.addr = id; } - Locker lk( _lock_iheap ); + scoped_lock lk( _lock_iheap ); iheap[id] = info; return id; @@ -142,21 +142,21 @@ if ( (id & extbit) ) { return badaddr; } else { - Locker _x1( _lock_heap ); + scoped_lock _x1( _lock_heap ); if ( unsafe_is_avail( id ) ) { return badaddr; } heap[id] = object; } { - Locker lk( _lock_xheap ); + scoped_lock lk( _lock_xheap ); gaddr_type& gaddr = _ex_heap[id]; gaddr.hid = xmt::hostid(); gaddr.pid = xmt::getpid(); gaddr.addr = id; } - Locker _x1( _lock_iheap ); + scoped_lock _x1( _lock_iheap ); iheap[id] = info; return id; @@ -176,14 +176,14 @@ { addr_type id; { - Locker _x1( _lock_xheap ); + scoped_lock _x1( _lock_xheap ); id = create_unique_x(); _ex_heap[id] = addr; _tr_heap.insert( make_pair( addr, make_pair( id, tr ) ) ); _ch_heap.insert( make_pair( tr.link, addr ) ); } { - Locker _x1( _lock_iheap ); + scoped_lock _x1( _lock_iheap ); iheap[id] = info; } @@ -205,13 +205,13 @@ addr_type id; if ( addr.hid == xmt::hostid() && addr.pid == xmt::getpid() ) { // local if ( addr.addr & extbit ) { // may be transit object - Locker lk( _lock_xheap ); + scoped_lock lk( _lock_xheap ); pair<uuid_tr_heap_type::const_iterator,uuid_tr_heap_type::const_iterator> range = _tr_heap.equal_range( addr ); if ( range.first != range.second ) { // transport present return min_element( range.first, range.second, tr_compare )->second.first; } } else { // may be local object - Locker lk( _lock_heap ); + scoped_lock lk( _lock_heap ); local_heap_type::const_iterator i = heap.find( addr.addr ); if ( i != heap.end() ) { return i->first; @@ -219,7 +219,7 @@ } return badaddr; // don't know what I can made } else { // foreign object - Locker lk( _lock_xheap ); + scoped_lock lk( _lock_xheap ); pair<uuid_tr_heap_type::const_iterator,uuid_tr_heap_type::const_iterator> tr_range = _tr_heap.equal_range( addr ); if ( tr_range.first != tr_range.second ) { // transport present return min_element( tr_range.first, tr_range.second, tr_compare )->second.first; @@ -239,7 +239,7 @@ _ex_heap[id] = addr; } { - Locker lk( _lock_iheap ); + scoped_lock lk( _lock_iheap ); iheap[id] = info; } return id; @@ -256,7 +256,7 @@ bool EvManager::Unsubscribe( addr_type id ) { if ( (id & extbit) ) { - Locker _x1( _lock_xheap ); + scoped_lock _x1( _lock_xheap ); gaddr_type& addr = _ex_heap[id]; pair<uuid_tr_heap_type::iterator,uuid_tr_heap_type::iterator> range = _tr_heap.equal_range( addr ); @@ -277,12 +277,12 @@ } _ex_heap.erase( id ); } else { - Locker _x1( _lock_heap ); + scoped_lock _x1( _lock_heap ); heap.erase( id ); // Notify remotes? } - Locker _x1( _lock_iheap ); + scoped_lock _x1( _lock_iheap ); iheap.erase( id ); return true; @@ -294,7 +294,7 @@ if ( addr.hid == xmt::hostid() && addr.pid == xmt::getpid() ) { // this host, this process if ( (addr.addr & extbit) == 0 ) { // looks like local object - Locker _x1( _lock_heap ); + scoped_lock _x1( _lock_heap ); local_heap_type::const_iterator l = heap.find( addr.addr ); if ( l != heap.end() ) { return addr.addr; // l->first @@ -307,7 +307,7 @@ // peer don't know host ids, used as access to 'standard' services and initial // communication if ( (addr.addr & extbit) == 0 && addr.addr <= _low ) { - Locker _x1( _lock_heap ); + scoped_lock _x1( _lock_heap ); local_heap_type::const_iterator l = heap.find( addr.addr ); if ( l != heap.end() ) { return addr.addr; // l->first @@ -318,7 +318,7 @@ } #endif - Locker _x1( _lock_xheap ); + scoped_lock _x1( _lock_xheap ); pair<uuid_tr_heap_type::const_iterator,uuid_tr_heap_type::const_iterator> range = _tr_heap.equal_range( addr ); if ( range.first != range.second ) { // transport present return min_element( range.first, range.second, tr_compare )->second.first; @@ -329,7 +329,7 @@ __FIT_DECLSPEC gaddr_type EvManager::reflect( addr_type addr ) const { - Locker lk( _lock_xheap ); + scoped_lock lk( _lock_xheap ); ext_uuid_heap_type::const_iterator i = _ex_heap.find( addr ); if ( i != _ex_heap.end() ) { return i->second; @@ -340,45 +340,45 @@ __FIT_DECLSPEC void EvManager::Remove( void *channel ) { - Locker _x1( _lock_xheap ); - Locker _x2( _lock_iheap ); + scoped_lock _x1( _lock_xheap ); + scoped_lock _x2( _lock_iheap ); unsafe_Remove( channel ); } void EvManager::settrf( unsigned f ) { - Locker _x1( _lock_tr ); + scoped_lock _x1( _lock_tr ); _trflags |= f; } void EvManager::unsettrf( unsigned f ) { - Locker _x1( _lock_tr ); + scoped_lock _x1( _lock_tr ); _trflags &= (0xffffffff & ~f); } void EvManager::resettrf( unsigned f ) { - Locker _x1( _lock_tr ); + scoped_lock _x1( _lock_tr ); _trflags = f; } void EvManager::cleantrf() { - Locker _x1( _lock_tr ); + scoped_lock _x1( _lock_tr ); _trflags = 0; } unsigned EvManager::trflags() const { - Locker _x1( _lock_tr ); + scoped_lock _x1( _lock_tr ); return _trflags; } void EvManager::settrs( std::ostream *s ) { - Locker _x1( _lock_tr ); + scoped_lock _x1( _lock_tr ); _trs = s; } @@ -407,7 +407,7 @@ __FIT_DECLSPEC const detail::transport& EvManager::transport( addr_type id ) const { - Locker _x1( _lock_xheap ); + scoped_lock _x1( _lock_xheap ); if ( (id & extbit) != 0 ) { ext_uuid_heap_type::const_iterator i = _ex_heap.find( id ); if ( i == _ex_heap.end() ) { @@ -470,7 +470,7 @@ if ( !reinterpret_cast<NetTransport_base *>(link)->push( e, gaddr_dst, gaddr_src) ) { #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracenet) ) { *_trs << "Remove net channel " << link << endl; } @@ -493,7 +493,7 @@ catch ( std::logic_error& err ) { // #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << err.what() << " " << __FILE__ << ":" << __LINE__ << endl; @@ -507,7 +507,7 @@ catch ( std::runtime_error& err ) { // #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << err.what() << " " << __FILE__ << ":" << __LINE__ << endl; @@ -521,7 +521,7 @@ catch ( ... ) { // #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << "Unknown, uncatched exception: " << __FILE__ << ":" << __LINE__ << endl; @@ -545,7 +545,7 @@ try { #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracedispatch) ) { *_trs << object->classtype().name() << " (" << object << ")\n"; @@ -560,7 +560,7 @@ } catch ( std::logic_error& err ) { try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << err.what() << "\n" << object->classtype().name() << " (" << object << ")\n"; @@ -573,7 +573,7 @@ } catch ( ... ) { try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << "Unknown, uncatched exception during process:\n" << object->classtype().name() << " (" << object << ")\n"; @@ -588,7 +588,7 @@ catch ( std::logic_error& err ) { // #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << err.what() << "\n" << __FILE__ << ":" << __LINE__ << endl; @@ -602,7 +602,7 @@ catch ( std::runtime_error& err ) { // #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << err.what() << " " << __FILE__ << ":" << __LINE__ << endl; @@ -616,7 +616,7 @@ catch ( ... ) { // #ifdef __FIT_STEM_TRACE try { - Locker lk(_lock_tr); + scoped_lock lk(_lock_tr); if ( _trs != 0 && _trs->good() && (_trflags & tracefault) ) { *_trs << "Unknown, uncatched exception: " << __FILE__ << ":" << __LINE__ << endl; @@ -690,7 +690,7 @@ s << hex << showbase; { - Locker lk( _lock_heap ); + scoped_lock lk( _lock_heap ); for ( local_heap_type::const_iterator i = heap.begin(); i != heap.end(); ++i ) { s << i->first << "\t=> " << i->second << "\n"; @@ -699,7 +699,7 @@ s << "\nInfo map:\n"; { - Locker lk( _lock_iheap ); + scoped_lock lk( _lock_iheap ); for ( info_heap_type::const_iterator i = iheap.begin(); i != iheap.end(); ++i ) { s << i->first << "\t=> '" << i->second << "'\n"; @@ -707,7 +707,7 @@ } { - Locker lk( _lock_xheap ); + scoped_lock lk( _lock_xheap ); s << "\nExternal address map:\n"; for ( ext_uuid_heap_type::const_iterator i = _ex_heap.begin(); i != _ex_heap.end(); ++i ) { Modified: branches/complement-xmt/explore/lib/stem/NetTransport.cc =================================================================== --- branches/complement-xmt/explore/lib/stem/NetTransport.cc 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/lib/stem/NetTransport.cc 2007-06-29 09:52:17 UTC (rev 1587) @@ -362,7 +362,7 @@ while ( me.pop( ev, dst, src ) ) { #ifdef __FIT_STEM_TRACE try { - xmt::Locker lk(manager()->_lock_tr); + xmt::scoped_lock lk(manager()->_lock_tr); if ( manager()->_trs != 0 && manager()->_trs->good() && (manager()->_trflags & EvManager::tracenet) ) { *manager()->_trs << "Pid/ppid: " << xmt::getpid() << "/" << xmt::getppid() << "\n"; manager()->dump( *manager()->_trs ) << endl; @@ -375,7 +375,7 @@ if ( xdst == badaddr ) { #ifdef __FIT_STEM_TRACE try { - xmt::Locker lk(manager()->_lock_tr); + xmt::scoped_lock lk(manager()->_lock_tr); if ( manager()->_trs != 0 && manager()->_trs->good() && (manager()->_trflags & (EvManager::tracefault)) ) { *manager()->_trs << __FILE__ << ":" << __LINE__ << " (" @@ -398,7 +398,7 @@ } #ifdef __FIT_STEM_TRACE try { - xmt::Locker lk(manager()->_lock_tr); + xmt::scoped_lock lk(manager()->_lock_tr); if ( manager()->_trs != 0 && manager()->_trs->good() && (manager()->_trflags & (EvManager::tracenet)) ) { *manager()->_trs << __FILE__ << ":" << __LINE__ << endl; } Modified: branches/complement-xmt/explore/test/sockios/sockios_test.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-06-14 06:47:19 UTC (rev 1586) +++ branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-06-29 09:52:17 UTC (rev 1587) @@ -59,10 +59,10 @@ { public: Cnt( sockstream& ) - { xmt::Locker lk(lock); ++cnt; ++visits; } + { xmt::scoped_lock lk(lock); ++cnt; ++visits; } ~Cnt() - { xmt::Locker lk(lock); --cnt; } + { xmt::scoped_lock lk(lock); --cnt; } void connect( sockstream& ) { } @@ -71,7 +71,7 @@ { } static int get_visits() - { xmt::Locker lk(lock); return visits; } + { xmt::scoped_lock lk(lock); return visits; } static xmt::Mutex lock; static int cnt; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-06-29 10:44:47
|
Revision: 1588 http://svn.sourceforge.net/complement/?rev=1588&view=rev Author: complement Date: 2007-06-29 03:44:29 -0700 (Fri, 29 Jun 2007) Log Message: ----------- Mutex was replaced by mutex Modified Paths: -------------- branches/complement-xmt/explore/include/mt/shm.h branches/complement-xmt/explore/include/mt/thr_mgr.h branches/complement-xmt/explore/include/mt/xmt.h branches/complement-xmt/explore/include/sockios/sockmgr.h branches/complement-xmt/explore/include/sockios/sockstream branches/complement-xmt/explore/include/stem/Cron.h branches/complement-xmt/explore/include/stem/EvManager.h branches/complement-xmt/explore/include/stem/EventHandler.h branches/complement-xmt/explore/lib/mt/ChangeLog branches/complement-xmt/explore/lib/mt/time.cc branches/complement-xmt/explore/lib/mt/uid.cc branches/complement-xmt/explore/lib/mt/xmt.cc branches/complement-xmt/explore/lib/sockios/ChangeLog branches/complement-xmt/explore/lib/sockios/_sockmgr.cc branches/complement-xmt/explore/lib/sockios/_sockstream.cc branches/complement-xmt/explore/lib/stem/ChangeLog branches/complement-xmt/explore/lib/stem/EvManager.cc branches/complement-xmt/explore/lib/stem/_EventHandler.cc branches/complement-xmt/explore/test/mt/flck.cc branches/complement-xmt/explore/test/mt/lfs.cc branches/complement-xmt/explore/test/mt/mt_test.cc branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc branches/complement-xmt/explore/test/sockios/close_socket.cc branches/complement-xmt/explore/test/sockios/message.cc branches/complement-xmt/explore/test/sockios/message.h 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-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/mt/shm.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -88,13 +88,13 @@ }; template <> -struct ipc_sharable<xmt::__Mutex<false,true> > +struct ipc_sharable<xmt::__mutex<false,true> > { typedef std::__true_type is_ipc_sharable; }; template <> -struct ipc_sharable<xmt::__Mutex<true,true> > +struct ipc_sharable<xmt::__mutex<true,true> > { typedef std::__true_type is_ipc_sharable; }; @@ -303,7 +303,7 @@ template <class T> void named( const T& obj, int name ) { - xmt::basic_lock<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__mutex<false,true> > lk( _lock ); if ( _last == 255 ) { throw std::range_error( "too many named objects" ); } @@ -328,7 +328,7 @@ template <class T> T& named( int name ) { - xmt::basic_lock<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { ++_nm_table[i].count; @@ -341,7 +341,7 @@ template <class T> const T& named( int name ) const { - xmt::basic_lock<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { ++_nm_table[i].count; @@ -354,7 +354,7 @@ template <class T> void release( int name ) { - xmt::basic_lock<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { if ( --_nm_table[i].count == 0 ) { @@ -371,7 +371,7 @@ int count( int name ) const throw() { - xmt::basic_lock<__Mutex<false,true> > lk( _lock ); + xmt::basic_lock<__mutex<false,true> > lk( _lock ); for ( int i = 0; _nm_table[i].name != -1; ++i ) { if ( _nm_table[i].name == name ) { return _nm_table[i].count; @@ -391,7 +391,7 @@ shm_name_mgr& operator =( const shm_name_mgr& ) { return *this; } - xmt::__Mutex<false,true> _lock; + xmt::__mutex<false,true> _lock; struct _name_rec { int name; @@ -420,7 +420,7 @@ { uint64_t _magic; size_type _first; - xmt::__Mutex<false,true> _lock; + xmt::__mutex<false,true> _lock; size_type _nm; }; @@ -463,7 +463,7 @@ if ( p != reinterpret_cast<pointer>(-1) && (force || _seg.count() <= 1) ) { _master *m = reinterpret_cast<_master *>( _seg.address() ); - (&m->_lock)->~__Mutex<false,true>(); + (&m->_lock)->~__mutex<false,true>(); if ( m->_nm != 0 ) { reinterpret_cast<shm_name_mgr<_Inst> *>(reinterpret_cast<char *>(p) + m->_nm)->~shm_name_mgr<_Inst>(); } @@ -480,7 +480,7 @@ if ( p != reinterpret_cast<pointer>(-1) ) { _master *m = reinterpret_cast<_master *>( p ); if ( m->_nm == 0 ) { - xmt::basic_lock<xmt::__Mutex<false,true> > lk( m->_lock ); + xmt::basic_lock<xmt::__mutex<false,true> > lk( m->_lock ); void *nm = _traverse( &m->_first, sizeof(shm_name_mgr<_Inst>) ); m->_nm = reinterpret_cast<char *>(nm) - reinterpret_cast<char *>(p); return *new ( nm ) shm_name_mgr<_Inst>(); @@ -496,7 +496,7 @@ { _master *m = reinterpret_cast<_master *>( _seg.address() ); if ( m != reinterpret_cast<_master *>(-1) ) { - xmt::basic_lock<xmt::__Mutex<false,true> > lk( m->_lock ); + xmt::basic_lock<xmt::__mutex<false,true> > lk( m->_lock ); return _traverse( &m->_first, n ); } @@ -512,8 +512,8 @@ static void init( _master& m ) { m._magic = MAGIC; - new ( &m._lock ) xmt::__Mutex<false,true>(); - xmt::basic_lock<xmt::__Mutex<false,true> > lk( m._lock ); + new ( &m._lock ) xmt::__mutex<false,true>(); + xmt::basic_lock<xmt::__mutex<false,true> > lk( m._lock ); m._first = sizeof( _master ); m._nm = 0; _fheader& h = *new ( reinterpret_cast<char *>(&m) + sizeof(_master) ) _fheader(); @@ -535,7 +535,7 @@ n = max( n + (__align - n % __align) % __align, sizeof(_fheader) ); _master *m = reinterpret_cast<_master *>( _seg.address() ); if ( m != reinterpret_cast<_master *>(-1) && (reinterpret_cast<char *>(p) - reinterpret_cast<char *>(_seg.address())) < (_seg.max_size() + sizeof(_master) + sizeof(_aheader) ) ) { - xmt::basic_lock<xmt::__Mutex<false,true> > lk( m->_lock ); + xmt::basic_lock<xmt::__mutex<false,true> > lk( m->_lock ); _aheader *a = reinterpret_cast<_aheader *>( reinterpret_cast<char *>(p) - sizeof(_aheader) ); size_type off = reinterpret_cast<char *>(p) - reinterpret_cast<char *>(_seg.address()); if ( m->_first == 0 ) { Modified: branches/complement-xmt/explore/include/mt/thr_mgr.h =================================================================== --- branches/complement-xmt/explore/include/mt/thr_mgr.h 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/mt/thr_mgr.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -46,7 +46,7 @@ protected: _Sequence _M_c; - Mutex _lock; + mutex _lock; }; } // namespace xmt Modified: branches/complement-xmt/explore/include/mt/xmt.h =================================================================== --- branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -314,23 +314,23 @@ #endif // __FIT_PTHREAD_SPINLOCK -// Portable Mutex implementation. If the parameter RECURSIVE_SAFE -// is true, Mutex will be recursive safe (detect deadlock). +// Portable mutex implementation. If the parameter RECURSIVE_SAFE +// is true, mutex will be recursive safe (detect deadlock). // If RECURSIVE_SAFE is false, implementation may not to be // recursive-safe. -// The SCOPE parameter designate Mutex scope---shared between +// The SCOPE parameter designate mutex scope---shared between // processes (true), or only inside threads of one process (false). // Note, that not all OS support interprocess mutex scope // (for example, Windows and Linux). template <bool RECURSIVE_SAFE, bool SCOPE> -class __Mutex : +class __mutex : public __mutex_base<RECURSIVE_SAFE,SCOPE> { public: - __Mutex() + __mutex() { } - ~__Mutex() + ~__mutex() { } void lock() @@ -378,7 +378,7 @@ } private: - __Mutex( const __Mutex& ) + __mutex( const __mutex& ) { } #ifndef __FIT_WIN32THREADS @@ -531,11 +531,11 @@ // __mutex_base above). template <bool SCOPE> -class __Mutex<true,SCOPE> : // Recursive Safe +class __mutex<true,SCOPE> : // Recursive Safe public __mutex_base<true,SCOPE> { public: - __Mutex() : + __mutex() : _count( 0 ), # ifdef __FIT_UITHREADS _id( __STATIC_CAST(thread_t,-1) ) @@ -545,7 +545,7 @@ # endif { } - ~__Mutex() + ~__mutex() { } void lock() @@ -628,7 +628,7 @@ } private: - __Mutex( const __Mutex& ) + __mutex( const __mutex& ) { } protected: @@ -719,14 +719,14 @@ }; template <bool SCOPE> -class __MutexRW : +class __mutexRW : public __mutex_rw_base<SCOPE> { public: - __MutexRW() + __mutexRW() { } - ~__MutexRW() + ~__mutexRW() { } void rdlock() @@ -816,7 +816,7 @@ } private: - __MutexRW( const __MutexRW& ) + __mutexRW( const __mutexRW& ) { } }; @@ -902,23 +902,23 @@ }; #endif // __FIT_RWLOCK -typedef __Mutex<false,false> Mutex; -typedef __Mutex<true,false> MutexRS; -typedef __Mutex<true,false> MutexSDS; // obsolete, use instead MutexRS +typedef __mutex<false,false> mutex; +typedef __mutex<true,false> mutexRS; +typedef __mutex<true,false> mutexSDS; // obsolete, use instead mutexRS #ifdef __FIT_RWLOCK -typedef __MutexRW<false> MutexRW; +typedef __mutexRW<false> mutexRW; #endif // __FIT_RWLOCK #ifdef __FIT_PTHREAD_SPINLOCK typedef __Spinlock<false,false> Spinlock; typedef __Spinlock<true,false> SpinlockRS; #endif // __FIT_RWLOCK -typedef basic_lock<Mutex> scoped_lock; -typedef basic_lock<MutexRS> LockerRS; -typedef basic_lock<MutexRS> LockerSDS; // obsolete, use instead LockerRS +typedef basic_lock<mutex> scoped_lock; +typedef basic_lock<mutexRS> LockerRS; +typedef basic_lock<mutexRS> LockerSDS; // obsolete, use instead LockerRS #ifdef __FIT_RWLOCK -typedef basic_read_lock<__MutexRW<false> > LockerRd; -typedef basic_lock<__MutexRW<false> > LockerWr; +typedef basic_read_lock<__mutexRW<false> > LockerRd; +typedef basic_lock<__mutexRW<false> > LockerWr; #endif // __FIT_RWLOCK #ifdef __FIT_PTHREAD_SPINLOCK typedef basic_lock<Spinlock> LockerSpin; @@ -1019,7 +1019,7 @@ bool set( bool __v, bool _broadcast = false ) { - basic_lock<__Mutex<false,SCOPE> > _x1( _lock ); + basic_lock<__mutex<false,SCOPE> > _x1( _lock ); bool tmp = _val; _val = __v; @@ -1060,7 +1060,7 @@ _lock.lock(); #endif #if defined(__FIT_UITHREADS) || defined(_PTHREADS) - basic_lock<__Mutex<false,SCOPE> > _x1( _lock ); + basic_lock<__mutex<false,SCOPE> > _x1( _lock ); #endif if ( _val == false ) { #ifdef __FIT_WIN32THREADS @@ -1103,7 +1103,7 @@ return 0; #endif #if defined(_PTHREADS) || defined(__FIT_UITHREADS) - basic_lock<__Mutex<false,SCOPE> > lk( _lock ); + basic_lock<__mutex<false,SCOPE> > lk( _lock ); _val = false; int ret; while ( !_val ) { @@ -1141,7 +1141,7 @@ int signal( bool _broadcast = false ) { - basic_lock<__Mutex<false,SCOPE> > _x1( _lock ); + basic_lock<__mutex<false,SCOPE> > _x1( _lock ); _val = true; #ifdef __FIT_WIN32THREADS @@ -1168,7 +1168,7 @@ #ifdef __FIT_UITHREADS cond_t _cond; #endif - __Mutex<false,SCOPE> _lock; + __mutex<false,SCOPE> _lock; bool _val; private: @@ -1527,7 +1527,7 @@ static alloc_type alloc; static int _idx; // user words index static int _self_idx; // user words index, that word point to self - static Mutex _idx_lock; + static mutex _idx_lock; static thread_key_type& _mt_key; size_t uw_alloc_size; @@ -1548,7 +1548,7 @@ size_t _param_sz; unsigned _flags; size_t _stack_sz; // stack size, if not 0 - // Mutex _llock; + // mutex _llock; friend class Init; // extern "C", wrap for thread_create #ifdef __unix Modified: branches/complement-xmt/explore/include/sockios/sockmgr.h =================================================================== --- branches/complement-xmt/explore/include/sockios/sockmgr.h 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/sockios/sockmgr.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -113,7 +113,7 @@ friend class Init; protected: - xmt::Mutex _fd_lck; + xmt::mutex _fd_lck; xmt::Condition _loop_cnd; }; @@ -288,16 +288,16 @@ _Sequence _M_c; _Compare _M_comp; pfd_equal _pfdcomp; - xmt::Mutex _c_lock; + xmt::mutex _c_lock; _fd_sequence _pfd; int _cfd; // sock_base::socket_type _connect_pool_sequence _conn_pool; xmt::Condition _pool_cnd; - xmt::Mutex _dlock; + xmt::mutex _dlock; timespec _tpop; - xmt::Mutex _flock; + xmt::mutex _flock; bool _follow; xmt::Condition _observer_cnd; @@ -419,7 +419,7 @@ _Sequence _M_c; _Compare _M_comp; in_buf_avail _M_av; - xmt::Mutex _c_lock; + xmt::mutex _c_lock; fd_set _pfdr; fd_set _pfde; Modified: branches/complement-xmt/explore/include/sockios/sockstream =================================================================== --- branches/complement-xmt/explore/include/sockios/sockstream 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/sockios/sockstream 2007-06-29 10:44:29 UTC (rev 1588) @@ -546,8 +546,8 @@ virtual streamsize xsputn(const char_type *s, streamsize n); public: - xmt::Mutex _M_lock_w; // lock for writing - // _STL_mutex_base _M_lock; used for read lock + xmt::mutex _M_lock_w; // lock for writing + private: // Helper functions charT* _bbuf; charT* _ebuf; Modified: branches/complement-xmt/explore/include/stem/Cron.h =================================================================== --- branches/complement-xmt/explore/include/stem/Cron.h 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/stem/Cron.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -165,7 +165,7 @@ std::greater<value_type> > container_type; container_type _M_c; - xmt::Mutex _M_l; + xmt::mutex _M_l; private: DECLARE_RESPONSE_TABLE( Cron, EventHandler ); Modified: branches/complement-xmt/explore/include/stem/EvManager.h =================================================================== --- branches/complement-xmt/explore/include/stem/EvManager.h 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/stem/EvManager.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -248,15 +248,15 @@ xmt::Thread _ev_queue_thr; xmt::Spinlock _ev_queue_dispatch_guard; - xmt::Mutex _lock_heap; - xmt::Mutex _lock_iheap; - xmt::Mutex _lock_xheap; + xmt::mutex _lock_heap; + xmt::mutex _lock_iheap; + xmt::mutex _lock_xheap; - xmt::Mutex _lock_queue; + xmt::mutex _lock_queue; xmt::Condition _cnd_queue; static std::string inv_key_str; - xmt::Mutex _lock_tr; + xmt::mutex _lock_tr; unsigned _trflags; std::ostream *_trs; Modified: branches/complement-xmt/explore/include/stem/EventHandler.h =================================================================== --- branches/complement-xmt/explore/include/stem/EventHandler.h 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/include/stem/EventHandler.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -542,7 +542,7 @@ // See comment near EventHandler::EventHandler() implementation // HistoryContainer& theHistory; HistoryContainer theHistory; - xmt::MutexRS _theHistory_lock; + xmt::mutexRS _theHistory_lock; public: Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 10:44:29 UTC (rev 1588) @@ -2,6 +2,8 @@ * xmt.h, xmt.cc, uid.cc, thr_mgr.cc: replace Locker by scoped_lock. + * shm.h, xmt.h, xmt.cc, thr_mgr.h, uid.cc, time.cc: all Mutex replaced by mutex + 2007-06-14 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc, shm.h: step to interface like boost or Modified: branches/complement-xmt/explore/lib/mt/time.cc =================================================================== --- branches/complement-xmt/explore/lib/mt/time.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/mt/time.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -14,7 +14,7 @@ #include <sys/time.h> #ifdef _WIN32 -xmt::Mutex _l; +xmt::mutex _l; #endif std::string calendar_time( time_t t ) Modified: branches/complement-xmt/explore/lib/mt/uid.cc =================================================================== --- branches/complement-xmt/explore/lib/mt/uid.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/mt/uid.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -36,7 +36,7 @@ __uid_init::__uid_init() { - static Mutex _lk; + static mutex _lk; scoped_lock lock( _lk ); ifstream f( "/proc/sys/kernel/random/boot_id" ); Modified: branches/complement-xmt/explore/lib/mt/xmt.cc =================================================================== --- branches/complement-xmt/explore/lib/mt/xmt.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/mt/xmt.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -88,7 +88,7 @@ # endif #ifdef _PTHREADS -xmt::Mutex _F_lock; +xmt::mutex _F_lock; # define _F_locklock xmt::detail::_F_lock.lock(); # define _F_lockunlock xmt::detail::_F_lock.unlock(); #endif @@ -220,7 +220,7 @@ Thread::alloc_type Thread::alloc; int Thread::_idx = 0; int Thread::_self_idx = 0; -Mutex Thread::_idx_lock; +mutex Thread::_idx_lock; #ifdef __FIT_WIN32THREADS const Thread::thread_id_type Thread::bad_thread_id = INVALID_HANDLE_VALUE; Modified: branches/complement-xmt/explore/lib/sockios/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/sockios/ChangeLog 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/sockios/ChangeLog 2007-06-29 10:44:29 UTC (rev 1588) @@ -2,6 +2,9 @@ * sockmgr.cc, sockios_test.cc: replace Locker by scoped_lock. + * sockmgr.h, sockstream, _sockmgr.cc, _sockstream.cc: all + Mutex replaced by mutex + 2007-02-12 Petr Ovtchenkov <pt...@is...> * sockmgr.h, _sockmgr.cc: use Init technique to initialize Modified: branches/complement-xmt/explore/lib/sockios/_sockmgr.cc =================================================================== --- branches/complement-xmt/explore/lib/sockios/_sockmgr.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/sockios/_sockmgr.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -51,7 +51,7 @@ void basic_sockmgr::Init::_guard( int direction ) { - static xmt::Mutex _init_lock; + static xmt::mutex _init_lock; static int _count = 0; if ( direction ) { Modified: branches/complement-xmt/explore/lib/sockios/_sockstream.cc =================================================================== --- branches/complement-xmt/explore/lib/sockios/_sockstream.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/sockios/_sockstream.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -66,7 +66,7 @@ static int __glob_init_cnt = 0; static int __glob_init_wsock2 = 0; -static xmt::Mutex _SI_lock; +static xmt::mutex _SI_lock; enum { WINDOWS_NT_4, Modified: branches/complement-xmt/explore/lib/stem/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/stem/ChangeLog 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/stem/ChangeLog 2007-06-29 10:44:29 UTC (rev 1588) @@ -2,6 +2,9 @@ * NetTransport.cc, EvManager.cc: replace Locker by scoped_lock. + * EvManager.cc, _EventHandler.cc, EventHandler.h, EvManager.h, Cron.h: + all Mutex replaced by mutex + 2007-03-12 Petr Ovtchenkov <pt...@is...> * EvManager.h, EvManager.cc: trace-related locks, flags and Modified: branches/complement-xmt/explore/lib/stem/EvManager.cc =================================================================== --- branches/complement-xmt/explore/lib/stem/EvManager.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/stem/EvManager.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -81,7 +81,7 @@ EvManager& me = *reinterpret_cast<EvManager *>(p); xmt::Thread::ret_code rt; rt.iword = 0; - xmt::Mutex& lq = me._lock_queue; + xmt::mutex& lq = me._lock_queue; queue_type& in_ev_queue = me.in_ev_queue; queue_type& out_ev_queue = me.out_ev_queue; Modified: branches/complement-xmt/explore/lib/stem/_EventHandler.cc =================================================================== --- branches/complement-xmt/explore/lib/stem/_EventHandler.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/lib/stem/_EventHandler.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -50,7 +50,7 @@ void EventHandler::Init::_guard( int direction ) { - static xmt::MutexRS _init_lock; + static xmt::mutexRS _init_lock; static int _count = 0; if ( direction ) { Modified: branches/complement-xmt/explore/test/mt/flck.cc =================================================================== --- branches/complement-xmt/explore/test/mt/flck.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/mt/flck.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -27,8 +27,8 @@ using namespace std; static const char *fname = "myfile"; -static Mutex m; -static Mutex b; +static mutex m; +static mutex b; static int cnt = 0; static Thread::ret_code thread_func( void * ) Modified: branches/complement-xmt/explore/test/mt/lfs.cc =================================================================== --- branches/complement-xmt/explore/test/mt/lfs.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/mt/lfs.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -27,8 +27,8 @@ using namespace std; static const char *fname = "myfile"; -static Mutex m; -static Mutex b; +static mutex m; +static mutex b; static int cnt = 0; static Condition cnd; Modified: branches/complement-xmt/explore/test/mt/mt_test.cc =================================================================== --- branches/complement-xmt/explore/test/mt/mt_test.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/mt/mt_test.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -131,7 +131,7 @@ * Correct order checked by values of x. */ -static xmt::Mutex m1; +static xmt::mutex m1; xmt::Thread::ret_code thr1( void *p ) { @@ -287,7 +287,7 @@ * */ -xmt::__Mutex<true,false> m2; +xmt::__mutex<true,false> m2; void recursive() { @@ -895,7 +895,7 @@ static int my_thr_cnt = 0; static int my_thr_scnt = 0; -static xmt::Mutex lock; +static xmt::mutex lock; xmt::Thread::ret_code thread_mgr_entry_call( void * ) { Modified: branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -41,7 +41,7 @@ */ extern int port; -extern xmt::Mutex pr_lock; +extern xmt::mutex pr_lock; static Condition cnd; Modified: branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -32,7 +32,7 @@ */ extern int port; -extern xmt::Mutex pr_lock; +extern xmt::mutex pr_lock; static Condition cnd; Modified: branches/complement-xmt/explore/test/sockios/close_socket.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/close_socket.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/sockios/close_socket.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -41,7 +41,7 @@ */ extern int port; -extern xmt::Mutex pr_lock; +extern xmt::mutex pr_lock; class ConnectionProcessor3 // dummy variant { Modified: branches/complement-xmt/explore/test/sockios/message.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/message.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/sockios/message.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -33,7 +33,7 @@ int port = 2048; -xmt::Mutex pr_lock; +xmt::mutex pr_lock; namespace test_area { Modified: branches/complement-xmt/explore/test/sockios/message.h =================================================================== --- branches/complement-xmt/explore/test/sockios/message.h 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/sockios/message.h 2007-06-29 10:44:29 UTC (rev 1588) @@ -37,7 +37,7 @@ extern int port; -extern xmt::Mutex pr_lock; +extern xmt::mutex pr_lock; #define OUT_MSG(msg) pr_lock.lock(); cerr << msg << endl; pr_lock.unlock() Modified: branches/complement-xmt/explore/test/sockios/sockios_test.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-06-29 09:52:17 UTC (rev 1587) +++ branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-06-29 10:44:29 UTC (rev 1588) @@ -73,12 +73,12 @@ static int get_visits() { xmt::scoped_lock lk(lock); return visits; } - static xmt::Mutex lock; + static xmt::mutex lock; static int cnt; static int visits; }; -xmt::Mutex Cnt::lock; +xmt::mutex Cnt::lock; int Cnt::cnt = 0; int Cnt::visits = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-06-29 11:25:34
|
Revision: 1589 http://svn.sourceforge.net/complement/?rev=1589&view=rev Author: complement Date: 2007-06-29 04:25:32 -0700 (Fri, 29 Jun 2007) Log Message: ----------- mutexRS renamed to recursive_mutex; LockerRS renamed to recursive_scoped_lock; LockerSDS to recursive_scoped_lock Modified Paths: -------------- branches/complement-xmt/explore/include/mt/xmt.h branches/complement-xmt/explore/include/stem/EventHandler.h branches/complement-xmt/explore/lib/mt/ChangeLog branches/complement-xmt/explore/lib/stem/ChangeLog branches/complement-xmt/explore/lib/stem/_EventHandler.cc Modified: branches/complement-xmt/explore/include/mt/xmt.h =================================================================== --- branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 10:44:29 UTC (rev 1588) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 11:25:32 UTC (rev 1589) @@ -58,7 +58,6 @@ # define MT_REENTRANT(point,nm) xmt::scoped_lock nm(point) # define MT_REENTRANT_RS(point,nm) xmt::LockerRS nm(point) -# define MT_REENTRANT_SDS(point,nm) xmt::LockerSDS nm(point) // obsolete, use MT_REENTRANT_RS # define MT_LOCK(point) point.lock() # define MT_UNLOCK(point) point.unlock() # ifdef __FIT_RWLOCK @@ -77,7 +76,6 @@ # define MT_REENTRANT(point,nm) ((void)0) # define MT_REENTRANT_RS(point,nm) ((void)0) -# define MT_REENTRANT_SDS(point,nm) ((void)0) // obsolete, use MT_REENTRANT_RS # define MT_LOCK(point) ((void)0) # define MT_UNLOCK(point) ((void)0) # define MT_REENTRANT_RD(point,nm) ((void)0) @@ -903,8 +901,7 @@ #endif // __FIT_RWLOCK typedef __mutex<false,false> mutex; -typedef __mutex<true,false> mutexRS; -typedef __mutex<true,false> mutexSDS; // obsolete, use instead mutexRS +typedef __mutex<true,false> recursive_mutex; #ifdef __FIT_RWLOCK typedef __mutexRW<false> mutexRW; #endif // __FIT_RWLOCK @@ -913,9 +910,8 @@ typedef __Spinlock<true,false> SpinlockRS; #endif // __FIT_RWLOCK -typedef basic_lock<mutex> scoped_lock; -typedef basic_lock<mutexRS> LockerRS; -typedef basic_lock<mutexRS> LockerSDS; // obsolete, use instead LockerRS +typedef basic_lock<mutex> scoped_lock; +typedef basic_lock<recursive_mutex> recursive_scoped_lock; #ifdef __FIT_RWLOCK typedef basic_read_lock<__mutexRW<false> > LockerRd; typedef basic_lock<__mutexRW<false> > LockerWr; Modified: branches/complement-xmt/explore/include/stem/EventHandler.h =================================================================== --- branches/complement-xmt/explore/include/stem/EventHandler.h 2007-06-29 10:44:29 UTC (rev 1588) +++ branches/complement-xmt/explore/include/stem/EventHandler.h 2007-06-29 11:25:32 UTC (rev 1589) @@ -542,7 +542,7 @@ // See comment near EventHandler::EventHandler() implementation // HistoryContainer& theHistory; HistoryContainer theHistory; - xmt::mutexRS _theHistory_lock; + xmt::recursive_mutex _theHistory_lock; public: @@ -705,7 +705,7 @@ { theEventsTable.Out( out ); } \ virtual bool DispatchTrace( const stem::Event& __e, std::ostream& __s )\ { \ - MT_REENTRANT_SDS( this->_theHistory_lock, _x1 ); \ + xmt::recursive_scoped_lock lk( this->_theHistory_lock ); \ return theEventsTable.DispatchTrace( theHistory.begin(), \ theHistory.end(), __e, __s ); } \ virtual const std::type_info& classtype() const \ @@ -718,12 +718,12 @@ protected: \ virtual bool Dispatch( const stem::Event& __e ) \ { \ - MT_REENTRANT_SDS( this->_theHistory_lock, _x1 ); \ + xmt::recursive_scoped_lock lk( this->_theHistory_lock ); \ return theEventsTable.Dispatch( this, theHistory.begin(), \ theHistory.end(), __e ); } \ virtual bool DispatchStub( const stem::Event& __e ) \ { \ - MT_REENTRANT_SDS( this->_theHistory_lock, _x1 ); \ + xmt::recursive_scoped_lock lk( this->_theHistory_lock ); \ return theEventsTable.DispatchStub( this, theHistory.begin(), \ theHistory.end(), __e ); } \ static __FIT_DECLSPEC evtable_type theEventsTable; \ Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 10:44:29 UTC (rev 1588) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 11:25:32 UTC (rev 1589) @@ -2,8 +2,11 @@ * xmt.h, xmt.cc, uid.cc, thr_mgr.cc: replace Locker by scoped_lock. - * shm.h, xmt.h, xmt.cc, thr_mgr.h, uid.cc, time.cc: all Mutex replaced by mutex + * shm.h, xmt.h, xmt.cc, thr_mgr.h, uid.cc, time.cc: all Mutex replaced by mutex; + * xmt.h: mutexRS renamed to recursive_mutex; LockerRS renamed to + recursive_scoped_lock; obsolete LockerSDS removed; + 2007-06-14 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc, shm.h: step to interface like boost or Modified: branches/complement-xmt/explore/lib/stem/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/stem/ChangeLog 2007-06-29 10:44:29 UTC (rev 1588) +++ branches/complement-xmt/explore/lib/stem/ChangeLog 2007-06-29 11:25:32 UTC (rev 1589) @@ -5,6 +5,10 @@ * EvManager.cc, _EventHandler.cc, EventHandler.h, EvManager.h, Cron.h: all Mutex replaced by mutex + * EventHandler.h, _EventHandler.cc: mutexRS renamed to recursive_mutex; + LockerRS renamed to recursive_scoped_lock; obsolete LockerSDS + replaced by recursive_scoped_lock; + 2007-03-12 Petr Ovtchenkov <pt...@is...> * EvManager.h, EvManager.cc: trace-related locks, flags and Modified: branches/complement-xmt/explore/lib/stem/_EventHandler.cc =================================================================== --- branches/complement-xmt/explore/lib/stem/_EventHandler.cc 2007-06-29 10:44:29 UTC (rev 1588) +++ branches/complement-xmt/explore/lib/stem/_EventHandler.cc 2007-06-29 11:25:32 UTC (rev 1589) @@ -50,7 +50,7 @@ void EventHandler::Init::_guard( int direction ) { - static xmt::mutexRS _init_lock; + static xmt::recursive_mutex _init_lock; static int _count = 0; if ( direction ) { @@ -122,21 +122,21 @@ void EventHandler::PushState( state_type state ) { RemoveState( state ); - MT_REENTRANT_SDS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); theHistory.push_front( state ); } __FIT_DECLSPEC state_type EventHandler::State() const { - MT_REENTRANT_SDS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); return theHistory.front(); } __FIT_DECLSPEC void EventHandler::PushTState( state_type state ) { - MT_REENTRANT_SDS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); theHistory.push_front( ST_TERMINAL ); theHistory.push_front( state ); } @@ -144,7 +144,7 @@ __FIT_DECLSPEC void EventHandler::PopState() { - MT_REENTRANT_SDS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); theHistory.pop_front(); while ( theHistory.front() == ST_TERMINAL ) { theHistory.pop_front(); @@ -154,7 +154,7 @@ __FIT_DECLSPEC void EventHandler::PopState( state_type state ) { - MT_REENTRANT_SDS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); h_iterator hst_i = __find( state ); if ( hst_i != theHistory.end() && *hst_i != ST_TERMINAL ) { theHistory.erase( theHistory.begin(), ++hst_i ); @@ -164,7 +164,7 @@ __FIT_DECLSPEC void EventHandler::RemoveState( state_type state ) { - MT_REENTRANT_SDS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); h_iterator hst_i = __find( state ); if ( hst_i != theHistory.end() && *hst_i != ST_TERMINAL ) { theHistory.erase( hst_i ); @@ -174,7 +174,7 @@ __FIT_DECLSPEC bool EventHandler::isState( state_type state ) const { - MT_REENTRANT_SDS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); const HistoryContainer& hst = theHistory; const_h_iterator hst_i = __find( state ); if ( hst_i != hst.end() && *hst_i != ST_TERMINAL ) { @@ -249,7 +249,7 @@ __FIT_DECLSPEC void EventHandler::TraceStack( ostream& out ) const { - MT_REENTRANT_RS( _theHistory_lock, _x1 ); + xmt::recursive_scoped_lock lk( _theHistory_lock ); const HistoryContainer& hst = theHistory; HistoryContainer::const_iterator hst_i = hst.begin(); while ( hst_i != hst.end() ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-06-29 12:03:14
|
Revision: 1590 http://svn.sourceforge.net/complement/?rev=1590&view=rev Author: complement Date: 2007-06-29 05:03:13 -0700 (Fri, 29 Jun 2007) Log Message: ----------- LockerRd renamed to rd_scoped_lock, LockerWr to wr_scoped_lock, __mutex_rw_base to __rw_mutex_base, mutexRW to rw_mutex. Modified Paths: -------------- branches/complement-xmt/explore/include/mt/xmt.h branches/complement-xmt/explore/lib/mt/ChangeLog Modified: branches/complement-xmt/explore/include/mt/xmt.h =================================================================== --- branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 11:25:32 UTC (rev 1589) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 12:03:13 UTC (rev 1590) @@ -57,20 +57,8 @@ #ifdef _REENTRANT # define MT_REENTRANT(point,nm) xmt::scoped_lock nm(point) -# define MT_REENTRANT_RS(point,nm) xmt::LockerRS nm(point) # define MT_LOCK(point) point.lock() # define MT_UNLOCK(point) point.unlock() -# ifdef __FIT_RWLOCK -# define MT_REENTRANT_RD(point,nm) xmt::LockerRd nm(point) -# define MT_REENTRANT_WR(point,nm) xmt::LockerWr nm(point) -# define MT_LOCK_RD(point) point.rdlock() -# define MT_LOCK_WR(point) point.wrlock() -# else // !__FIT_RWLOCK -# define MT_REENTRANT_RD(point,nm) ((void)0) -# define MT_REENTRANT_WR(point,nm) ((void)0) -# define MT_LOCK_RD(point) ((void)0) -# define MT_LOCK_WR(point) ((void)0) -# endif // __FIT_RWLOCK #else // !_REENTRANT @@ -78,10 +66,6 @@ # define MT_REENTRANT_RS(point,nm) ((void)0) # define MT_LOCK(point) ((void)0) # define MT_UNLOCK(point) ((void)0) -# define MT_REENTRANT_RD(point,nm) ((void)0) -# define MT_REENTRANT_WR(point,nm) ((void)0) -# define MT_LOCK_RD(point) ((void)0) -# define MT_LOCK_WR(point) ((void)0) #endif // _REENTRANT @@ -647,10 +631,10 @@ // Read-write mutex: IEEE Std 1003.1, 2001, 2004 Editions template <bool SCOPE> -class __mutex_rw_base +class __rw_mutex_base { public: - __mutex_rw_base() + __rw_mutex_base() { #ifdef _PTHREADS if ( SCOPE ) { @@ -683,7 +667,7 @@ #endif } - ~__mutex_rw_base() + ~__rw_mutex_base() { #ifdef _PTHREADS pthread_rwlock_destroy( &_M_lock ); @@ -699,7 +683,7 @@ } private: - __mutex_rw_base( const __mutex_rw_base& ) + __rw_mutex_base( const __rw_mutex_base& ) { } protected: @@ -717,14 +701,14 @@ }; template <bool SCOPE> -class __mutexRW : - public __mutex_rw_base<SCOPE> +class __rw_mutex : + public __rw_mutex_base<SCOPE> { public: - __mutexRW() + __rw_mutex() { } - ~__mutexRW() + ~__rw_mutex() { } void rdlock() @@ -814,7 +798,7 @@ } private: - __mutexRW( const __mutexRW& ) + __rw_mutex( const __rw_mutex& ) { } }; @@ -903,7 +887,7 @@ typedef __mutex<false,false> mutex; typedef __mutex<true,false> recursive_mutex; #ifdef __FIT_RWLOCK -typedef __mutexRW<false> mutexRW; +typedef __rw_mutex<false> rw_mutex; #endif // __FIT_RWLOCK #ifdef __FIT_PTHREAD_SPINLOCK typedef __Spinlock<false,false> Spinlock; @@ -913,8 +897,8 @@ typedef basic_lock<mutex> scoped_lock; typedef basic_lock<recursive_mutex> recursive_scoped_lock; #ifdef __FIT_RWLOCK -typedef basic_read_lock<__mutexRW<false> > LockerRd; -typedef basic_lock<__mutexRW<false> > LockerWr; +typedef basic_read_lock<__rw_mutex<false> > rd_scoped_lock; +typedef basic_lock<__rw_mutex<false> > wr_scoped_lock; #endif // __FIT_RWLOCK #ifdef __FIT_PTHREAD_SPINLOCK typedef basic_lock<Spinlock> LockerSpin; Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 11:25:32 UTC (rev 1589) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 12:03:13 UTC (rev 1590) @@ -7,6 +7,9 @@ * xmt.h: mutexRS renamed to recursive_mutex; LockerRS renamed to recursive_scoped_lock; obsolete LockerSDS removed; + * xmt.h: LockerRd renamed to rd_scoped_lock, LockerWr to wr_scoped_lock, + __mutex_rw_base to __rw_mutex_base, mutexRW to rw_mutex. + 2007-06-14 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc, shm.h: step to interface like boost or This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-06-29 12:40:15
|
Revision: 1591 http://svn.sourceforge.net/complement/?rev=1591&view=rev Author: complement Date: 2007-06-29 05:40:12 -0700 (Fri, 29 Jun 2007) Log Message: ----------- Spinlock was renamed to spinlock, LockerExt to native_scoped_lock Modified Paths: -------------- branches/complement-xmt/explore/include/mt/xmt.h branches/complement-xmt/explore/include/stem/EvManager.h branches/complement-xmt/explore/lib/mt/ChangeLog branches/complement-xmt/explore/lib/stem/EvManager.cc branches/complement-xmt/explore/test/mt/mt_test.cc Modified: branches/complement-xmt/explore/include/mt/xmt.h =================================================================== --- branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 12:03:13 UTC (rev 1590) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-06-29 12:40:12 UTC (rev 1591) @@ -372,17 +372,17 @@ #ifdef __FIT_PTHREAD_SPINLOCK // Spinlock-based locks (IEEE Std. 1003.1j-2000) -template <bool RS, bool SCOPE> class __Spinlock; +template <bool RS, bool SCOPE> class __spinlock; template <bool SCOPE> -class __Spinlock<false,SCOPE> : +class __spinlock<false,SCOPE> : public __spinlock_base<SCOPE> { public: - __Spinlock() + __spinlock() { } - ~__Spinlock() + ~__spinlock() { } void lock() @@ -408,17 +408,22 @@ pthread_spin_unlock( &this->_M_lock ); # endif } + + private: + __spinlock( const __spinlock& ) + { } + }; template <bool SCOPE> -class __Spinlock<true,SCOPE> : // Recursive safe +class __spinlock<true,SCOPE> : // Recursive safe public __spinlock_base<SCOPE> { public: - __Spinlock() + __spinlock() { } - ~__Spinlock() + ~__spinlock() { } void lock() @@ -493,6 +498,10 @@ # ifdef __FIT_UITHREADS thread_t _id; # endif + + private: + __spinlock( const __spinlock& ) + { } }; #endif // __FIT_PTHREAD_SPINLOCK @@ -890,8 +899,8 @@ typedef __rw_mutex<false> rw_mutex; #endif // __FIT_RWLOCK #ifdef __FIT_PTHREAD_SPINLOCK -typedef __Spinlock<false,false> Spinlock; -typedef __Spinlock<true,false> SpinlockRS; +typedef __spinlock<false,false> spinlock; +typedef __spinlock<true,false> recursive_spinlock; #endif // __FIT_RWLOCK typedef basic_lock<mutex> scoped_lock; @@ -901,21 +910,21 @@ typedef basic_lock<__rw_mutex<false> > wr_scoped_lock; #endif // __FIT_RWLOCK #ifdef __FIT_PTHREAD_SPINLOCK -typedef basic_lock<Spinlock> LockerSpin; -typedef basic_lock<SpinlockRS> LockerSpinRS; +typedef basic_lock<spinlock> spin_scoped_lock; +typedef basic_lock<recursive_spinlock> recursive_spin_scoped_lock; #endif // __FIT_RWLOCK -class LockerExt +class native_scoped_lock { public: #ifdef _PTHREADS - explicit LockerExt( const pthread_mutex_t& m ) : + explicit native_scoped_lock( const pthread_mutex_t& m ) : #endif #ifdef __FIT_UITHREADS - explicit LockerExt( const mutex_t& m ) : + explicit native_scoped_lock( const mutex_t& m ) : #endif #ifdef __FIT_WIN32THREADS - explicit LockerExt( const CRITICAL_SECTION& m ) : + explicit native_scoped_lock( const CRITICAL_SECTION& m ) : #endif _M_lock( m ) { @@ -930,7 +939,7 @@ #endif } - ~LockerExt() + ~native_scoped_lock() { #ifdef _PTHREADS pthread_mutex_unlock( const_cast<pthread_mutex_t *>(&_M_lock) ); @@ -944,7 +953,7 @@ } private: - LockerExt( const LockerExt& m ) : + native_scoped_lock( const native_scoped_lock& m ) : _M_lock( m._M_lock ) { } #ifdef _PTHREADS Modified: branches/complement-xmt/explore/include/stem/EvManager.h =================================================================== --- branches/complement-xmt/explore/include/stem/EvManager.h 2007-06-29 12:03:13 UTC (rev 1590) +++ branches/complement-xmt/explore/include/stem/EvManager.h 2007-06-29 12:40:12 UTC (rev 1591) @@ -246,7 +246,7 @@ bool _dispatch_stop; xmt::Thread _ev_queue_thr; - xmt::Spinlock _ev_queue_dispatch_guard; + xmt::spinlock _ev_queue_dispatch_guard; xmt::mutex _lock_heap; xmt::mutex _lock_iheap; Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 12:03:13 UTC (rev 1590) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-06-29 12:40:12 UTC (rev 1591) @@ -8,8 +8,10 @@ recursive_scoped_lock; obsolete LockerSDS removed; * xmt.h: LockerRd renamed to rd_scoped_lock, LockerWr to wr_scoped_lock, - __mutex_rw_base to __rw_mutex_base, mutexRW to rw_mutex. + __mutex_rw_base to __rw_mutex_base, mutexRW to rw_mutex; + * xmt.h: Spinlock was renamed to spinlock, LockerExt to native_scoped_lock. + 2007-06-14 Petr Ovtchenkov <pt...@is...> * xmt.h, xmt.cc, shm.h: step to interface like boost or Modified: branches/complement-xmt/explore/lib/stem/EvManager.cc =================================================================== --- branches/complement-xmt/explore/lib/stem/EvManager.cc 2007-06-29 12:03:13 UTC (rev 1590) +++ branches/complement-xmt/explore/lib/stem/EvManager.cc 2007-06-29 12:40:12 UTC (rev 1591) @@ -72,7 +72,7 @@ bool EvManager::not_finished() { - xmt::LockerSpin _lk( _ev_queue_dispatch_guard ); + xmt::spin_scoped_lock _lk( _ev_queue_dispatch_guard ); return !_dispatch_stop; } Modified: branches/complement-xmt/explore/test/mt/mt_test.cc =================================================================== --- branches/complement-xmt/explore/test/mt/mt_test.cc 2007-06-29 12:03:13 UTC (rev 1590) +++ branches/complement-xmt/explore/test/mt/mt_test.cc 2007-06-29 12:40:12 UTC (rev 1591) @@ -198,7 +198,7 @@ */ #ifdef __FIT_PTHREAD_SPINLOCK -static xmt::Spinlock sl1; +static xmt::spinlock sl1; xmt::Thread::ret_code thr1s( void *p ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-11 17:56:04
|
Revision: 1603 http://svn.sourceforge.net/complement/?rev=1603&view=rev Author: complement Date: 2007-07-11 10:56:00 -0700 (Wed, 11 Jul 2007) Log Message: ----------- Condition replaced by condition Modified Paths: -------------- branches/complement-xmt/explore/include/mt/shm.h branches/complement-xmt/explore/include/mt/xmt.h branches/complement-xmt/explore/include/sockios/sockmgr.cc branches/complement-xmt/explore/include/sockios/sockmgr.h branches/complement-xmt/explore/include/stem/Cron.h branches/complement-xmt/explore/include/stem/EvManager.h branches/complement-xmt/explore/lib/mt/ChangeLog branches/complement-xmt/explore/lib/sockios/ChangeLog branches/complement-xmt/explore/lib/stem/ChangeLog branches/complement-xmt/explore/test/mt/lfs.cc branches/complement-xmt/explore/test/mt/mt_test.cc branches/complement-xmt/explore/test/mt/signal-1.cc branches/complement-xmt/explore/test/mt/signal-3.cc branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc branches/complement-xmt/explore/test/sockios/client-wc.cc branches/complement-xmt/explore/test/sockios/close_socket.cc branches/complement-xmt/explore/test/sockios/sockios_test.cc branches/complement-xmt/explore/test/stem/Echo.h branches/complement-xmt/explore/test/stem/NameService.h branches/complement-xmt/explore/test/stem/Node.h branches/complement-xmt/explore/test/stem/NodeDL.h branches/complement-xmt/explore/test/stem/unit_test.cc Modified: branches/complement-xmt/explore/include/mt/shm.h =================================================================== --- branches/complement-xmt/explore/include/mt/shm.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/include/mt/shm.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/06/14 10:16:59 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 20:52:38 ptr> /* * Copyright (c) 2006, 2007 @@ -70,7 +70,7 @@ }; template <> -struct ipc_sharable<xmt::__Condition<true> > +struct ipc_sharable<xmt::__condition<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 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/include/mt/xmt.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/06/14 10:15:07 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 20:51:27 ptr> /* * Copyright (c) 1997-1999, 2002-2007 @@ -182,7 +182,7 @@ #endif // !_WIN32 -template <bool SCOPE> class __Condition; +template <bool SCOPE> class __condition; // if parameter SCOPE (process scope) true, PTHREAD_PROCESS_SHARED will // be used; otherwise PTHREAD_PROCESS_PRIVATE. @@ -264,7 +264,7 @@ #ifndef __FIT_WIN32THREADS private: - friend class __Condition<SCOPE>; + friend class __condition<SCOPE>; #endif }; @@ -365,7 +365,7 @@ #ifndef __FIT_WIN32THREADS private: - friend class __Condition<SCOPE>; + friend class __condition<SCOPE>; #endif }; @@ -968,10 +968,10 @@ }; template <bool SCOPE> -class __Condition +class __condition { public: - __Condition() : + __condition() : _val( true ) { #ifdef __FIT_WIN32THREADS @@ -993,7 +993,7 @@ #endif } - ~__Condition() + ~__condition() { #ifdef __FIT_WIN32THREADS CloseHandle( _cond ); @@ -1045,15 +1045,11 @@ int try_wait() { -#if defined(__FIT_WIN32THREADS) - _lock.lock(); -#endif -#if defined(__FIT_UITHREADS) || defined(_PTHREADS) basic_lock<__mutex<false,SCOPE> > _x1( _lock ); -#endif + if ( _val == false ) { #ifdef __FIT_WIN32THREADS - _lock.unlock(); + _x1.unlock(); if ( WaitForSingleObject( _cond, -1 ) == WAIT_FAILED ) { return -1; } @@ -1073,27 +1069,24 @@ return ret; #endif } -#if defined(__FIT_WIN32THREADS) - _lock.unlock(); -#endif + return 0; } int wait() { -#ifdef __FIT_WIN32THREADS - MT_LOCK( _lock ); + basic_lock<__mutex<false,SCOPE> > lk( _lock ); _val = false; + +#ifdef __FIT_WIN32THREADS ResetEvent( _cond ); - MT_UNLOCK( _lock ); + lk.unlock(); if ( WaitForSingleObject( _cond, -1 ) == WAIT_FAILED ) { return -1; } return 0; #endif #if defined(_PTHREADS) || defined(__FIT_UITHREADS) - basic_lock<__mutex<false,SCOPE> > lk( _lock ); - _val = false; int ret; while ( !_val ) { ret = @@ -1161,11 +1154,11 @@ bool _val; private: - __Condition( const __Condition& ) + __condition( const __condition& ) { } }; -typedef __Condition<false> Condition; +typedef __condition<false> condition; template <bool SCOPE> class __Semaphore @@ -1526,7 +1519,7 @@ # ifndef __hpux // sorry, POSIX threads don't have suspend/resume calls, so it should // be simulated via cond_wait - __Condition<false> _suspend; + __condition<false> _suspend; # endif #endif #ifdef __FIT_WIN32THREADS @@ -1549,7 +1542,7 @@ }; template <bool SCOPE> -int __Condition<SCOPE>::try_wait_time( const ::timespec *abstime ) +int __condition<SCOPE>::try_wait_time( const ::timespec *abstime ) { #if defined(__FIT_WIN32THREADS) MT_LOCK( _lock ); @@ -1605,7 +1598,7 @@ } template <bool SCOPE> -int __Condition<SCOPE>::try_wait_delay( const ::timespec *interval ) +int __condition<SCOPE>::try_wait_delay( const ::timespec *interval ) { #if defined(__FIT_WIN32THREADS) MT_LOCK( _lock ); @@ -1667,7 +1660,7 @@ } template <bool SCOPE> -int __Condition<SCOPE>::wait_time( const ::timespec *abstime ) +int __condition<SCOPE>::wait_time( const ::timespec *abstime ) { #ifdef __FIT_WIN32THREADS MT_LOCK( _lock ); @@ -1717,7 +1710,7 @@ } template <bool SCOPE> -int __Condition<SCOPE>::wait_delay( const ::timespec *interval ) +int __condition<SCOPE>::wait_delay( const ::timespec *interval ) { #ifdef __FIT_WIN32THREADS MT_LOCK( _lock ); Modified: branches/complement-xmt/explore/include/sockios/sockmgr.cc =================================================================== --- branches/complement-xmt/explore/include/sockios/sockmgr.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/include/sockios/sockmgr.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/02/01 19:50:14 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:14:42 ptr> /* * Copyright (c) 1997-1999, 2002, 2003, 2005-2007 @@ -29,7 +29,7 @@ template <class Connect> void sockmgr_stream_MP<Connect>::_open( sock_base::stype t ) { - MT_REENTRANT( _fd_lck, _1 ); + xmt::scoped_lock lk(_fd_lck); if ( is_open_unsafe() ) { if ( t == sock_base::sock_stream ) { _accept = &_Self_type::accept_tcp; @@ -204,7 +204,7 @@ } if ( _pfd[0].revents != 0 ) { - MT_REENTRANT( _fd_lck, _1 ); + xmt::scoped_lock lk(_fd_lck); if ( !is_open_unsafe() ) { // may be already closed return false; } @@ -224,7 +224,7 @@ if ( cl_new->s.rdbuf()->in_avail() > 0 ) { // this is the case when user read from sockstream // in ctor above; push processing of this stream - MT_REENTRANT( _dlock, _1 ); + xmt::scoped_lock lk(_dlock); _conn_pool.push_back( --_M_c.end() ); _pool_cnd.set( true ); _observer_cnd.set( true ); @@ -404,7 +404,7 @@ if ( stream.is_open() && stream.good() ) { if ( stream.rdbuf()->in_avail() > 0 ) { // socket has buffered data, push it back to queue - MT_REENTRANT( me->_dlock, _1 ); + xmt::scoped_lock lk(me->_dlock); me->_conn_pool.push_back( c ); me->_observer_cnd.set( true ); me->_pool_cnd.set( true ); @@ -428,7 +428,7 @@ for ( idle_count = 0; idle_count < 2; ++idle_count ) { { - MT_REENTRANT( me->_dlock, _1 ); + xmt::scoped_lock lk(me->_dlock); if ( !me->_follow ) { break; } @@ -481,7 +481,7 @@ // std::swap( pool_size[0], pool_size[1] ); std::rotate( pool_size, pool_size, pool_size + 3 ); { - MT_REENTRANT( me->_dlock, _1 ); + xmt::scoped_lock lk(me->_dlock); pool_size[2] = static_cast<int>(me->_conn_pool.size()); tpop = me->_tpop; } @@ -535,7 +535,7 @@ template <class Connect> void sockmgr_stream_MP_SELECT<Connect>::_open( sock_base::stype t ) { - MT_REENTRANT( _fd_lck, _1 ); + xmt::scoped_lock lk(_fd_lck); if ( is_open_unsafe() ) { if ( t == sock_base::sock_stream ) { _accept = &_Self_type::accept_tcp; @@ -655,11 +655,11 @@ FD_ZERO( &_pfde ); // *** Set all listen sockets here... - MT_LOCK( _fd_lck ); + _fd_lck.lock(); FD_SET( fd_unsafe(), &_pfdr ); FD_SET( fd_unsafe(), &_pfde ); _fdmax = fd_unsafe(); - MT_UNLOCK( _fd_lck ); + _fd_lck.unlock(); for ( typename container_type::iterator i = _M_c.begin(); i != _M_c.end(); ++i ) { if ( (*i)->s->is_open() ) { FD_SET( (*i)->s->rdbuf()->fd(), &_pfdr ); @@ -677,7 +677,7 @@ return 0; // poll wait infinite, so it can't return 0 (timeout), so it return -1. } - MT_REENTRANT( _fd_lck, _1 ); + xmt::scoped_lock lk(_fd_lck); if ( !is_open_unsafe() || FD_ISSET( fd_unsafe(), &_pfde ) ) { // may be already closed return 0; } Modified: branches/complement-xmt/explore/include/sockios/sockmgr.h =================================================================== --- branches/complement-xmt/explore/include/sockios/sockmgr.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/include/sockios/sockmgr.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/02/12 14:50:57 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 20:57:31 ptr> /* * Copyright (c) 1997-1999, 2002, 2003, 2005-2007 @@ -85,19 +85,19 @@ public: bool is_open() const - { MT_REENTRANT( _fd_lck, _1 ); return is_open_unsafe(); } + { xmt::scoped_lock lk(_fd_lck); return is_open_unsafe(); } bool good() const { return _state == ios_base::goodbit; } sock_base::socket_type fd() const - { MT_REENTRANT( _fd_lck, _1 ); return fd_unsafe(); } + { xmt::scoped_lock lk(_fd_lck); return fd_unsafe(); } __FIT_DECLSPEC void shutdown( sock_base::shutdownflg dir ); void setoptions( sock_base::so_t optname, bool on_off = true, int __v = 0 ) { - MT_REENTRANT( _fd_lck, _1 ); + xmt::scoped_lock lk(_fd_lck); setoptions_unsafe( optname, on_off, __v ); } @@ -114,7 +114,7 @@ protected: xmt::mutex _fd_lck; - xmt::Condition _loop_cnd; + xmt::condition _loop_cnd; }; class ConnectionProcessorTemplate_MP // As reference @@ -293,14 +293,14 @@ _fd_sequence _pfd; int _cfd; // sock_base::socket_type _connect_pool_sequence _conn_pool; - xmt::Condition _pool_cnd; + xmt::condition _pool_cnd; xmt::mutex _dlock; timespec _tpop; xmt::mutex _flock; bool _follow; - xmt::Condition _observer_cnd; + xmt::condition _observer_cnd; timespec _busylimit; // start new thread to process incoming // requests, if processing thread busy // more then _busylimit Modified: branches/complement-xmt/explore/include/stem/Cron.h =================================================================== --- branches/complement-xmt/explore/include/stem/Cron.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/include/stem/Cron.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,7 +1,7 @@ -// -*- C++ -*- Time-stamp: <06/12/15 03:20:55 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:20:12 ptr> /* - * Copyright (c) 1998, 2002, 2003, 2005 + * Copyright (c) 1998, 2002, 2003, 2005, 2007 * Petr Ovtchenkov * * Copyright (c) 1999-2001 @@ -18,9 +18,7 @@ #include <config/feature.h> #endif -#ifndef __IOSFWD__ #include <iosfwd> -#endif #ifndef __stem_EventHandler_h #include <stem/EventHandler.h> @@ -157,7 +155,7 @@ static xmt::Thread::ret_code _loop( void * ); xmt::Thread _thr; - xmt::Condition cond; + xmt::condition cond; typedef __CronEntry value_type; typedef std::priority_queue<value_type, Modified: branches/complement-xmt/explore/include/stem/EvManager.h =================================================================== --- branches/complement-xmt/explore/include/stem/EvManager.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/include/stem/EvManager.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/03/12 17:18:41 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:17:27 ptr> /* * Copyright (c) 1995-1999, 2002, 2003, 2005, 2006 @@ -123,31 +123,31 @@ bool is_avail( addr_type id ) const { - MT_REENTRANT( _lock_heap, _x1 ); + xmt::scoped_lock lk( _lock_heap ); return unsafe_is_avail(id); } const std::string who_is( addr_type id ) const { - MT_REENTRANT( _lock_iheap, _x1 ); + xmt::scoped_lock lk( _lock_iheap ); return unsafe_who_is( id ); } const std::string annotate( addr_type id ) const { - MT_REENTRANT( _lock_iheap, _x1 ); + xmt::scoped_lock lk( _lock_iheap ); return unsafe_annotate( id ); } void change_announce( addr_type id, const std::string& info ) { - MT_REENTRANT( _lock_iheap, _x1 ); + xmt::scoped_lock lk( _lock_iheap ); unsafe_change_announce( id, info ); } void change_announce( addr_type id, const char *info ) { - MT_REENTRANT( _lock_iheap, _x1 ); + xmt::scoped_lock lk( _lock_iheap ); unsafe_change_announce( id, info ); } @@ -155,7 +155,7 @@ void push( const Event& e ) { - MT_REENTRANT( _lock_queue, _x1 ); + xmt::scoped_lock lk( _lock_queue ); in_ev_queue.push_back( e ); _cnd_queue.set( true ); } @@ -253,7 +253,7 @@ xmt::mutex _lock_xheap; xmt::mutex _lock_queue; - xmt::Condition _cnd_queue; + xmt::condition _cnd_queue; static std::string inv_key_str; xmt::mutex _lock_tr; Modified: branches/complement-xmt/explore/lib/mt/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/mt/ChangeLog 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/lib/mt/ChangeLog 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,3 +1,7 @@ +2007-07-11 Petr Ovtchenkov <pt...@is...> + + * xmt.h, shm.h: Condition replaced by condition. + 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/lib/sockios/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/sockios/ChangeLog 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/lib/sockios/ChangeLog 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,3 +1,7 @@ +2007-07-11 Petr Ovtchenkov <pt...@is...> + + * sockmgr.h, sockmgr.cc: Condition replaced by condition. + 2007-06-29 Petr Ovtchenkov <pt...@is...> * sockmgr.cc, sockios_test.cc: replace Locker by scoped_lock. Modified: branches/complement-xmt/explore/lib/stem/ChangeLog =================================================================== --- branches/complement-xmt/explore/lib/stem/ChangeLog 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/lib/stem/ChangeLog 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,3 +1,7 @@ +2007-07-11 Petr Ovtchenkov <pt...@is...> + + * EvManager.h, Cron.h: Condition replaced by condition. + 2007-06-29 Petr Ovtchenkov <pt...@is...> * NetTransport.cc, EvManager.cc: replace Locker by scoped_lock. Modified: branches/complement-xmt/explore/test/mt/lfs.cc =================================================================== --- branches/complement-xmt/explore/test/mt/lfs.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/mt/lfs.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/15 10:44:27 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:22:41 ptr> /* * Copyright (c) 2004, 2006 @@ -30,7 +30,7 @@ static mutex m; static mutex b; static int cnt = 0; -static Condition cnd; +static condition cnd; static Thread::ret_code thread_func( void * ) { Modified: branches/complement-xmt/explore/test/mt/mt_test.cc =================================================================== --- branches/complement-xmt/explore/test/mt/mt_test.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/mt/mt_test.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/03/12 20:39:47 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:25:32 ptr> /* * Copyright (c) 2006, 2007 @@ -383,7 +383,7 @@ // cerr << "Error on shmat" << endl; // } - xmt::__Condition<true>& fcnd = *new( buf ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new( buf ) xmt::__condition<true>(); fcnd.set( false ); try { @@ -414,7 +414,7 @@ catch ( ... ) { } - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shmdt( buf ); shmctl( id, IPC_RMID, &ds ); @@ -440,7 +440,7 @@ // cerr << "Error on shmat" << endl; // } - xmt::__Condition<true>& fcnd = *new( buf ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new( buf ) xmt::__condition<true>(); fcnd.set( false ); pid_t my_pid = xmt::getpid(); @@ -451,7 +451,7 @@ // Child code BOOST_CHECK( my_pid == xmt::getppid() ); - *reinterpret_cast<pid_t *>(static_cast<char *>(buf) + sizeof(xmt::__Condition<true>)) = xmt::getpid(); + *reinterpret_cast<pid_t *>(static_cast<char *>(buf) + sizeof(xmt::__condition<true>)) = xmt::getpid(); fcnd.set( true ); @@ -467,7 +467,7 @@ fcnd.try_wait(); - BOOST_CHECK( *reinterpret_cast<pid_t *>(static_cast<char *>(buf) + sizeof(xmt::__Condition<true>)) == child.pid() ); + BOOST_CHECK( *reinterpret_cast<pid_t *>(static_cast<char *>(buf) + sizeof(xmt::__condition<true>)) == child.pid() ); int stat; BOOST_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); @@ -478,7 +478,7 @@ catch ( ... ) { } - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shmdt( buf ); shmctl( id, IPC_RMID, &ds ); @@ -643,7 +643,7 @@ 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>(); + xmt::__condition<true>& fcnd = *new( shm.allocate( sizeof(xmt::__condition<true>) ) ) xmt::__condition<true>(); fcnd.set( false ); try { xmt::fork(); @@ -674,8 +674,8 @@ catch ( ... ) { } - (&fcnd)->~__Condition<true>(); - shm.deallocate( reinterpret_cast<char *>(&fcnd), sizeof(xmt::__Condition<true>) ); + (&fcnd)->~__condition<true>(); + shm.deallocate( reinterpret_cast<char *>(&fcnd), sizeof(xmt::__condition<true>) ); seg.deallocate(); fs::remove( fname ); } @@ -699,9 +699,9 @@ 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<xmt::__condition<true>,0> shm; - xmt::__Condition<true>& fcnd = *new ( shm.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm.allocate( 1 ) ) xmt::__condition<true>(); nm.named( fcnd, test_Condition_Object ); fcnd.set( false ); @@ -722,7 +722,7 @@ } 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 ); + xmt::__condition<true>& fcnd_ch = nm_ch.named<xmt::__condition<true> >( test_Condition_Object ); fcnd_ch.set( true ); } catch ( const xmt::shm_bad_alloc& err ) { @@ -754,7 +754,7 @@ BOOST_CHECK_MESSAGE( false, "Fail in fork" ); } - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shm.deallocate( &fcnd, 1 ); seg.deallocate(); fs::remove( fname ); @@ -794,9 +794,9 @@ try { xmt::shm_name_mgr<1>& nm = seg1.name_mgr(); - xmt::allocator_shm<xmt::__Condition<true>,1> shm; + xmt::allocator_shm<xmt::__condition<true>,1> shm; - xmt::__Condition<true>& fcnd = *new ( shm.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm.allocate( 1 ) ) xmt::__condition<true>(); nm.named( fcnd, ObjName ); fcnd.set( false ); @@ -805,10 +805,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 ); + 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 ); + nm_ch.release<xmt::__condition<true> >( ObjName ); } catch ( const std::invalid_argument& err ) { BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); @@ -820,9 +820,9 @@ int stat; BOOST_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); } - nm.release<xmt::__Condition<true> >( ObjName ); // fcnd should be destroyed here + nm.release<xmt::__condition<true> >( ObjName ); // fcnd should be destroyed here - xmt::__Condition<true>& fcnd1 = *new ( shm.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd1 = *new ( shm.allocate( 1 ) ) xmt::__condition<true>(); nm.named( fcnd1, ObjName ); // ObjName should be free here fcnd1.set( false ); @@ -831,10 +831,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 ); + 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 ); + nm_ch.release<xmt::__condition<true> >( ObjName ); } catch ( const std::invalid_argument& err ) { BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); @@ -847,7 +847,7 @@ int stat; BOOST_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); } - nm.release<xmt::__Condition<true> >( ObjName ); // fcnd should be destroyed here + 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>(); Modified: branches/complement-xmt/explore/test/mt/signal-1.cc =================================================================== --- branches/complement-xmt/explore/test/mt/signal-1.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/mt/signal-1.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/16 00:28:34 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:21:38 ptr> /* * Copyright (c) 2003, 2006 @@ -33,7 +33,7 @@ static int v = 0; -static Condition cnd; +static condition cnd; extern "C" { static void handler( int ); Modified: branches/complement-xmt/explore/test/mt/signal-3.cc =================================================================== --- branches/complement-xmt/explore/test/mt/signal-3.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/mt/signal-3.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/16 00:35:45 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:22:05 ptr> /* * Copyright (c) 2003, 2006 @@ -38,7 +38,7 @@ static int v = 0; -static Condition cnd; +static condition cnd; extern "C" { static void handler( int ); Modified: branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/sockios/bytes_in_socket.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/10/10 20:35:08 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:35:39 ptr> /* * @@ -43,7 +43,7 @@ extern int port; extern xmt::mutex pr_lock; -static Condition cnd; +static condition cnd; class ConnectionProcessor4 // dummy variant { Modified: branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/sockios/bytes_in_socket2.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/10/10 21:31:27 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:36:14 ptr> /* * @@ -34,7 +34,7 @@ extern int port; extern xmt::mutex pr_lock; -static Condition cnd; +static condition cnd; class ConnectionProcessor7 // dummy variant { Modified: branches/complement-xmt/explore/test/sockios/client-wc.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/client-wc.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/sockios/client-wc.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/01/29 17:48:29 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:34:07 ptr> /* * Copyright (c) 2004, 2006 @@ -28,7 +28,7 @@ Suspicious processing with FreeBSD and OpenBSD servers. */ -static Condition cnd_close; +static condition cnd_close; class Srv // { @@ -67,7 +67,7 @@ #endif static srv_type *srv_p; -Condition cnd; +condition cnd; Thread::ret_code server_proc( void * ) { Modified: branches/complement-xmt/explore/test/sockios/close_socket.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/close_socket.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/sockios/close_socket.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/08/04 12:03:39 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:34:53 ptr> /* * @@ -64,7 +64,7 @@ // with Input line prompt } -Condition cnd2; +condition cnd2; void ConnectionProcessor3::connect( std::sockstream& s ) { @@ -103,7 +103,7 @@ pr_lock.unlock(); } -Condition cnd1; +condition cnd1; // Condition cnd2; std::sockstream *psock = 0; Modified: branches/complement-xmt/explore/test/sockios/sockios_test.cc =================================================================== --- branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/sockios/sockios_test.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/02/26 17:18:51 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:40:23 ptr> /* * @@ -26,7 +26,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::__condition<true>,0> shm_cnd; xmt::allocator_shm<xmt::__Barrier<true>,0> shm_b; sockios_test::sockios_test() @@ -228,10 +228,10 @@ void sockios_test::sigpipe() { try { - xmt::__Condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); fcnd.set( false ); - xmt::__Condition<true>& tcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& tcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); tcnd.set( false ); try { @@ -284,9 +284,9 @@ } } - (&tcnd)->~__Condition<true>(); + (&tcnd)->~__condition<true>(); shm_cnd.deallocate( &tcnd, 1 ); - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shm_cnd.deallocate( &fcnd, 1 ); } catch ( xmt::shm_bad_alloc& err ) { @@ -304,7 +304,7 @@ void connect( std::sockstream& ); void close(); - static xmt::__Condition<true> *cnd; + static xmt::__condition<true> *cnd; }; long_msg_processor::long_msg_processor( std::sockstream& ) @@ -329,15 +329,15 @@ cnd->set( true ); } -xmt::__Condition<true> *long_msg_processor::cnd; +xmt::__condition<true> *long_msg_processor::cnd; void sockios_test::long_msg() { try { - xmt::__Condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); fcnd.set( false ); - xmt::__Condition<true>& srv_cnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& srv_cnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); srv_cnd.set( false ); long_msg_processor::cnd = &srv_cnd; @@ -380,10 +380,10 @@ } - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shm_cnd.deallocate( &fcnd, 1 ); - (&srv_cnd)->~__Condition<true>(); + (&srv_cnd)->~__condition<true>(); shm_cnd.deallocate( &srv_cnd, 1 ); } catch ( xmt::shm_bad_alloc& err ) { @@ -469,7 +469,7 @@ xmt::Thread::ret_code thread_entry( void *par ) { xmt::Thread::ret_code rt; - xmt::Condition& cnd = *reinterpret_cast<xmt::Condition *>(par); + xmt::condition& cnd = *reinterpret_cast<xmt::condition *>(par); // sem.wait(); // wait server for listen us sockstream sock( "localhost", ::port ); @@ -489,7 +489,7 @@ void sockios_test::read0() { try { - xmt::__Condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); xmt::__Barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__Barrier<true>(); ConnectionProcessor5::b = &b; // nm.named( fcnd, 1 ); @@ -499,7 +499,7 @@ xmt::fork(); // <---- key line fcnd.try_wait(); // wait server for listen us - xmt::Condition cnd; + xmt::condition cnd; cnd.set( false ); xmt::Thread thr( thread_entry, &cnd ); @@ -532,7 +532,7 @@ (&b)->~__Barrier<true>(); shm_b.deallocate( &b, 1 ); - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shm_cnd.deallocate( &fcnd, 1 ); } catch ( xmt::shm_bad_alloc& err ) { @@ -550,10 +550,10 @@ void connect( std::sockstream& ); void close(); - static xmt::Condition cnd; + static xmt::condition cnd; }; -xmt::Condition ConnectionProcessor6::cnd; +xmt::condition ConnectionProcessor6::cnd; ConnectionProcessor6::ConnectionProcessor6( std::sockstream& s ) { @@ -633,10 +633,10 @@ void connect( std::sockstream& ); void close(); - static xmt::Condition cnd; + static xmt::condition cnd; }; -xmt::Condition LongBlockReader::cnd; +xmt::condition LongBlockReader::cnd; LongBlockReader::LongBlockReader( std::sockstream& s ) { Modified: branches/complement-xmt/explore/test/stem/Echo.h =================================================================== --- branches/complement-xmt/explore/test/stem/Echo.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/stem/Echo.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/10/11 00:56:13 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:45:09 ptr> /* * Copyright (c) 2006 @@ -28,7 +28,7 @@ void echo( const stem::Event& ); void regme( const stem::Event& ); - xmt::Condition cnd; + xmt::condition cnd; private: DECLARE_RESPONSE_TABLE( StEMecho, stem::EventHandler ); @@ -50,7 +50,7 @@ const std::string mess; private: - xmt::Condition cnd; + xmt::condition cnd; DECLARE_RESPONSE_TABLE( EchoClient, stem::EventHandler ); }; @@ -72,7 +72,7 @@ const std::string mess; private: - xmt::Condition cnd; + xmt::condition cnd; DECLARE_RESPONSE_TABLE( PeerClient, stem::EventHandler ); }; Modified: branches/complement-xmt/explore/test/stem/NameService.h =================================================================== --- branches/complement-xmt/explore/test/stem/NameService.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/stem/NameService.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/11/24 19:33:11 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:47:37 ptr> /* * Copyright (c) 2006 @@ -36,7 +36,7 @@ nsrecords_type::container_type lst; private: - xmt::Condition cnd; + xmt::condition cnd; DECLARE_RESPONSE_TABLE( Naming, stem::EventHandler ); }; Modified: branches/complement-xmt/explore/test/stem/Node.h =================================================================== --- branches/complement-xmt/explore/test/stem/Node.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/stem/Node.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/09/29 22:53:43 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:47:25 ptr> /* * @@ -31,7 +31,7 @@ int v; private: - xmt::Condition cnd; + xmt::condition cnd; DECLARE_RESPONSE_TABLE( Node, stem::EventHandler ); }; @@ -52,7 +52,7 @@ int v; private: - xmt::Condition cnd; + xmt::condition cnd; DECLARE_RESPONSE_TABLE( NewNode, stem::EventHandler ); }; Modified: branches/complement-xmt/explore/test/stem/NodeDL.h =================================================================== --- branches/complement-xmt/explore/test/stem/NodeDL.h 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/stem/NodeDL.h 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/09/29 22:50:51 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:47:58 ptr> /* * @@ -30,7 +30,7 @@ int v; private: - xmt::Condition cnd; + xmt::condition cnd; DECLARE_RESPONSE_TABLE( NodeDL, stem::EventHandler ); }; @@ -51,7 +51,7 @@ int v; private: - xmt::Condition cnd; + xmt::condition cnd; DECLARE_RESPONSE_TABLE( NewNodeDL, stem::EventHandler ); }; Modified: branches/complement-xmt/explore/test/stem/unit_test.cc =================================================================== --- branches/complement-xmt/explore/test/stem/unit_test.cc 2007-07-11 07:35:11 UTC (rev 1602) +++ branches/complement-xmt/explore/test/stem/unit_test.cc 2007-07-11 17:56:00 UTC (rev 1603) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/03/12 21:20:54 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 21:46:57 ptr> /* * Copyright (c) 2002, 2003, 2006 @@ -295,7 +295,7 @@ const char fname[] = "/tmp/stem_test.shm"; xmt::shm_alloc<0> seg; -xmt::allocator_shm<xmt::__Condition<true>,0> shm_cnd; +xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; xmt::allocator_shm<xmt::__Barrier<true>,0> shm_b; void stem_test::shm_init() @@ -316,7 +316,7 @@ void stem_test::echo_net() { - xmt::__Condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); fcnd.set( false ); try { @@ -369,7 +369,7 @@ } } - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shm_cnd.deallocate( &fcnd, 1 ); // cerr << "Fine\n"; @@ -381,7 +381,7 @@ { try { xmt::__Barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__Barrier<true>(); - xmt::__Condition<true>& c = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& c = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); c.set( false ); @@ -439,7 +439,7 @@ BOOST_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() ); } - (&c)->~__Condition<true>(); + (&c)->~__condition<true>(); shm_cnd.deallocate( &c, 1 ); (&b)->~__Barrier<true>(); shm_b.deallocate( &b, 1 ); @@ -477,13 +477,13 @@ pid_t fpid; - xmt::__Condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); fcnd.set( false ); - xmt::__Condition<true>& pcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& pcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); pcnd.set( false ); - xmt::__Condition<true>& scnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& scnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); scnd.set( false ); try { @@ -653,17 +653,17 @@ srv.wait(); } - (&fcnd)->~__Condition<true>(); + (&fcnd)->~__condition<true>(); shm_cnd.deallocate( &fcnd, 1 ); - (&pcnd)->~__Condition<true>(); + (&pcnd)->~__condition<true>(); shm_cnd.deallocate( &pcnd, 1 ); - (&scnd)->~__Condition<true>(); + (&scnd)->~__condition<true>(); shm_cnd.deallocate( &scnd, 1 ); } void stem_test::boring_manager() { - xmt::__Condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__Condition<true>(); + xmt::__condition<true>& fcnd = *new ( shm_cnd.allocate( 1 ) ) xmt::__condition<true>(); fcnd.set( false ); try { @@ -707,7 +707,7 @@ srv.wait(); } - (&fcnd)->~__Condition<true>(); + (&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. |
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. |