[complement-svn] SF.net SVN: complement: [1945] trunk/complement/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-07-07 17:27:26
|
Revision: 1945 http://complement.svn.sourceforge.net/complement/?rev=1945&view=rev Author: complement Date: 2008-07-07 10:26:37 -0700 (Mon, 07 Jul 2008) Log Message: ----------- fix dispatch loop finish condition; libstem 4.8.1 (for git-svn) pass predicate to wait condition in dispatch loop; predicate check as non-empty income events queue, as flag for _dispatch_stop flag; spinlock, that cover only _dispatch_stop removed. Modified Paths: -------------- trunk/complement/explore/include/stem/EvManager.h trunk/complement/explore/lib/stem/ChangeLog trunk/complement/explore/lib/stem/EvManager.cc trunk/complement/explore/lib/stem/Makefile.inc Modified: trunk/complement/explore/include/stem/EvManager.h =================================================================== --- trunk/complement/explore/include/stem/EvManager.h 2008-07-07 10:30:59 UTC (rev 1944) +++ trunk/complement/explore/include/stem/EvManager.h 2008-07-07 17:26:37 UTC (rev 1945) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/27 12:35:36 ptr> +// -*- C++ -*- Time-stamp: <08/07/07 21:03:34 yeti> /* * Copyright (c) 1995-1999, 2002, 2003, 2005, 2006 @@ -266,6 +266,19 @@ } private: + struct _not_empty + { + _not_empty( EvManager& m ) : + me( m ) + { } + + bool operator()() const + { return !me.in_ev_queue.empty() || me._dispatch_stop; } + + EvManager& me; + } not_empty; + + void Send( const Event& e ); __FIT_DECLSPEC void unsafe_Remove( void * ); @@ -308,7 +321,6 @@ unsigned _trflags; std::ostream *_trs; - std::tr2::spinlock _ev_queue_dispatch_guard; std::tr2::thread _ev_queue_thr; friend class Names; Modified: trunk/complement/explore/lib/stem/ChangeLog =================================================================== --- trunk/complement/explore/lib/stem/ChangeLog 2008-07-07 10:30:59 UTC (rev 1944) +++ trunk/complement/explore/lib/stem/ChangeLog 2008-07-07 17:26:37 UTC (rev 1945) @@ -1,3 +1,10 @@ +2008-07-07 Petr Ovtchenkov <ye...@ya...> + + * EvManager.h, EvManager.cc: fix dispatch loop finish + condition; + + * libstem: library version 4.8.1. + 2008-06-27 Petr Ovtchenkov <pt...@is...> * Cron.h, EvManager.h, EventHandler.h, NetTransport.h: Modified: trunk/complement/explore/lib/stem/EvManager.cc =================================================================== --- trunk/complement/explore/lib/stem/EvManager.cc 2008-07-07 10:30:59 UTC (rev 1944) +++ trunk/complement/explore/lib/stem/EvManager.cc 2008-07-07 17:26:37 UTC (rev 1945) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/30 18:18:21 yeti> +// -*- C++ -*- Time-stamp: <08/07/07 21:01:28 yeti> /* * @@ -44,6 +44,7 @@ std::string EvManager::inv_key_str( "invalid key" ); __FIT_DECLSPEC EvManager::EvManager() : + not_empty( *this ), _low( beglocaddr ), _high( endlocaddr ), _id( _low ), @@ -62,7 +63,7 @@ __FIT_DECLSPEC EvManager::~EvManager() { { - lock_guard<spinlock> lk( _ev_queue_dispatch_guard ); + lock_guard<mutex> lk( _lock_queue ); _dispatch_stop = true; _cnd_queue.notify_one(); } @@ -72,7 +73,7 @@ bool EvManager::not_finished() { - lock_guard<spinlock> lk( _ev_queue_dispatch_guard ); + lock_guard<mutex> lk( _lock_queue ); return !_dispatch_stop; } @@ -94,9 +95,7 @@ } { unique_lock<mutex> lk( lq ); - if ( in_ev_queue.empty() && me.not_finished() ) { - me._cnd_queue.wait( lk ); - } + me._cnd_queue.wait( lk, me.not_empty ); } } } Modified: trunk/complement/explore/lib/stem/Makefile.inc =================================================================== --- trunk/complement/explore/lib/stem/Makefile.inc 2008-07-07 10:30:59 UTC (rev 1944) +++ trunk/complement/explore/lib/stem/Makefile.inc 2008-07-07 17:26:37 UTC (rev 1945) @@ -1,8 +1,8 @@ -# -*- Makefile -*- Time-stamp: <08/06/27 13:16:59 ptr> +# -*- Makefile -*- Time-stamp: <08/07/07 21:07:49 yeti> LIBNAME = stem MAJOR = 4 MINOR = 8 -PATCH = 0 +PATCH = 1 SRC_CC = _EventHandler.cc NetTransport.cc EvManager.cc EvPack.cc crc.cc \ Names.cc Cron.cc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |