Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10496/boost/thread_safe_signals Modified Files: connection.hpp slot.hpp Added Files: auto_threaded.hpp multi_threaded.hpp single_threaded.hpp Removed Files: trackable.hpp Log Message: Restored per-slot locking, due to unresolvable failures in deletion_test.cpp. Restored ThreadingModel parameter due to popular demand, but made default "signals::auto_threaded" which uses the lightweight_mutex. Removed obsolete trackable.hpp. --- NEW FILE: auto_threaded.hpp --- // Boost.Signals library // Copyright Frank Mori Hess 2007. // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // For more information, see http://www.boost.org #ifndef BOOST_SIGNALS_MULTI_THREADED_MODEL_HEADER #define BOOST_SIGNALS_MULTI_THREADED_MODEL_HEADER #include <boost/detail/lightweight_mutex.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace signalslib { class auto_threaded { public: typedef boost::detail::lightweight_mutex mutex_type; }; } // end namespace signalslib } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_MULTI_THREADED_MODEL_HEADER --- NEW FILE: single_threaded.hpp --- // Boost.Signals library // Copyright Frank Mori Hess 2007. // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // For more information, see http://www.boost.org #ifndef BOOST_SIGNALS_SINGLE_THREADED_MODEL_HEADER #define BOOST_SIGNALS_SINGLE_THREADED_MODEL_HEADER #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace signalslib { namespace detail { class null_mutex; class null_scoped_lock { public: null_scoped_lock(const null_mutex &mutex) {} bool locked() const {return true;} }; class null_mutex { public: typedef null_scoped_lock scoped_lock; }; } class single_threaded { public: typedef detail::null_mutex mutex_type; }; } // end namespace signalslib } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_SINGLE_THREADED_MODEL_HEADER --- NEW FILE: multi_threaded.hpp --- // Boost.Signals library // Copyright Frank Mori Hess 2007. // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // For more information, see http://www.boost.org #ifndef BOOST_SIGNALS_MULTI_THREADED_MODEL_HEADER #define BOOST_SIGNALS_MULTI_THREADED_MODEL_HEADER #include <boost/thread/mutex.hpp> #include <boost/thread/recursive_mutex.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace signalslib { class multi_threaded { public: typedef mutex mutex_type; }; } // end namespace signalslib } // end namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_SIGNALS_MULTI_THREADED_MODEL_HEADER Index: slot.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/slot.hpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- slot.hpp 27 Feb 2007 21:19:25 -0000 1.14 +++ slot.hpp 1 Mar 2007 15:57:25 -0000 1.15 @@ -19,7 +19,6 @@ #include <boost/thread_safe_signals/detail/signals_common_macros.hpp> #include <boost/thread_safe_signals/slot_base.hpp> #include <boost/thread_safe_signals/track.hpp> -#include <boost/thread_safe_signals/trackable.hpp> #include <boost/type_traits.hpp> #include <boost/utility/addressof.hpp> #include <boost/weak_ptr.hpp> Index: connection.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/connection.hpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- connection.hpp 28 Feb 2007 20:48:30 -0000 1.20 +++ connection.hpp 1 Mar 2007 15:57:25 -0000 1.21 @@ -25,7 +25,6 @@ #include <boost/mpl/bool.hpp> #include <boost/noncopyable.hpp> #include <boost/shared_ptr.hpp> -#include <boost/thread_safe_signals/detail/signal_base.hpp> #include <boost/thread_safe_signals/slot.hpp> #include <boost/thread_safe_signals/track.hpp> #include <boost/type_traits.hpp> @@ -42,8 +41,7 @@ class ConnectionBodyBase { public: - typedef signal_impl_base::mutex_type mutex_type; - ConnectionBodyBase(const shared_ptr<mutex_type> &mutex): _mutex(mutex), + ConnectionBodyBase(): _connected(true), _blocked(false) { } @@ -64,41 +62,40 @@ return _blocked || (nolock_nograb_connected() == false); } bool nolock_nograb_connected() const {return _connected;} -//FIXME: make _mutex protected once slot_call_iterator no longer needs it. - shared_ptr<mutex_type> _mutex; protected: mutable bool _connected; bool _blocked; }; - template<typename GroupKey, typename SlotType> + template<typename GroupKey, typename SlotType, typename ThreadingModel> class ConnectionBody: public ConnectionBodyBase { public: - ConnectionBody(const shared_ptr<mutex_type> &mutex, const SlotType &slot_in): - ConnectionBodyBase(mutex), slot(slot_in) + typedef typename ThreadingModel::mutex_type mutex_type; + ConnectionBody(const SlotType &slot_in): + slot(slot_in) { } virtual ~ConnectionBody() {} virtual void disconnect() { - typename mutex_type::scoped_lock lock(*_mutex); + typename mutex_type::scoped_lock lock(mutex); nolock_disconnect(); } virtual bool connected() const { - typename mutex_type::scoped_lock lock(*_mutex); + typename mutex_type::scoped_lock lock(mutex); nolock_grab_tracked_objects(); return nolock_nograb_connected(); } virtual void block(bool should_block) { - typename mutex_type::scoped_lock lock(*_mutex); + typename mutex_type::scoped_lock lock(mutex); _blocked = should_block; } virtual bool blocked() const { - typename mutex_type::scoped_lock lock(*_mutex); + typename mutex_type::scoped_lock lock(mutex); nolock_grab_tracked_objects(); return nolock_nograb_blocked(); } @@ -128,6 +125,7 @@ return locked_objects; } SlotType slot; + mutable mutex_type mutex; private: GroupKey _group_key; }; --- trackable.hpp DELETED --- |