|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48953 - in sandbox/thread_safe_signals/trunk/boost: . signals2 signals2/detail
From: fmhess_at_[hidden]
Date: 2008-09-24 15:45:33
Author: fmhess
Date: 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
New Revision: 48953
URL: http://svn.boost.org/trac/boost/changeset/48953
Log:
Replaced ThreadingModel template parameter with Mutex, which must be
a model of the Lockable concept from Boost.Thread plus DefaultConstructible.
Added:
sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_nop.hpp
- copied, changed from r48947, /trunk/boost/detail/lwm_nop.hpp
sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_pthreads.hpp
- copied, changed from r48947, /trunk/boost/detail/lwm_pthreads.hpp
sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_win32_cs.hpp
- copied, changed from r48947, /trunk/boost/detail/lwm_win32_cs.hpp
sandbox/thread_safe_signals/trunk/boost/signals2/detail/unique_lock.hpp (contents, props changed)
sandbox/thread_safe_signals/trunk/boost/signals2/dummy_mutex.hpp (contents, props changed)
sandbox/thread_safe_signals/trunk/boost/signals2/lightweight_mutex.hpp
- copied, changed from r48947, /trunk/boost/detail/lightweight_mutex.hpp
Removed:
sandbox/thread_safe_signals/trunk/boost/signals2/auto_threaded.hpp
sandbox/thread_safe_signals/trunk/boost/signals2/multi_threaded.hpp
sandbox/thread_safe_signals/trunk/boost/signals2/single_threaded.hpp
Text files modified:
sandbox/thread_safe_signals/trunk/boost/signals2.hpp | 1
sandbox/thread_safe_signals/trunk/boost/signals2/connection.hpp | 11 +++++----
sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_nop.hpp | 20 ++++++++--------
sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_pthreads.hpp | 45 ++++++++++++++++------------------------
sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_win32_cs.hpp | 45 ++++++++++++++++------------------------
sandbox/thread_safe_signals/trunk/boost/signals2/detail/signal_template.hpp | 42 ++++++++++++++++++------------------
sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_call_iterator.hpp | 3 +
sandbox/thread_safe_signals/trunk/boost/signals2/lightweight_mutex.hpp | 26 +++++++++-------------
sandbox/thread_safe_signals/trunk/boost/signals2/signal.hpp | 10 ++++----
9 files changed, 92 insertions(+), 111 deletions(-)
Modified: sandbox/thread_safe_signals/trunk/boost/signals2.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -8,4 +8,5 @@
// For more information, see http://www.boost.org
#include <boost/signals2/deconstruct_ptr.hpp>
+#include <boost/signals2/dummy_mutex.hpp>
#include <boost/signals2/signal.hpp>
Deleted: sandbox/thread_safe_signals/trunk/boost/signals2/auto_threaded.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/auto_threaded.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
+++ (empty file)
@@ -1,26 +0,0 @@
-// Boost.Signals library
-
-// Copyright Frank Mori Hess 2007-2008.
-// 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_AUTO_THREADED_MODEL_HEADER
-#define BOOST_SIGNALS_AUTO_THREADED_MODEL_HEADER
-
-#include <boost/detail/lightweight_mutex.hpp>
-
-namespace boost {
- namespace signals2 {
- class auto_threaded
- {
- public:
- typedef boost::detail::lightweight_mutex mutex_type;
- };
- } // end namespace signals2
-} // end namespace boost
-
-#endif // BOOST_SIGNALS_AUTO_THREADED_MODEL_HEADER
-
Modified: sandbox/thread_safe_signals/trunk/boost/signals2/connection.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/connection.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/connection.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -19,6 +19,7 @@
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/signals2/slot.hpp>
+#include <boost/signals2/detail/unique_lock.hpp>
#include <boost/type_traits.hpp>
#include <boost/visit_each.hpp>
#include <boost/weak_ptr.hpp>
@@ -61,11 +62,11 @@
weak_ptr<void> _weak_blocker;
};
- template<typename GroupKey, typename SlotType, typename ThreadingModel>
+ template<typename GroupKey, typename SlotType, typename Mutex>
class connection_body: public connection_body_base
{
public:
- typedef typename ThreadingModel::mutex_type mutex_type;
+ typedef Mutex mutex_type;
connection_body(const SlotType &slot_in):
slot(slot_in)
{
@@ -73,18 +74,18 @@
virtual ~connection_body() {}
virtual void disconnect()
{
- typename mutex_type::scoped_lock lock(mutex);
+ unique_lock<mutex_type> lock(mutex);
nolock_disconnect();
}
virtual bool connected() const
{
- typename mutex_type::scoped_lock lock(mutex);
+ unique_lock<mutex_type> lock(mutex);
nolock_grab_tracked_objects();
return nolock_nograb_connected();
}
virtual shared_ptr<void> get_blocker()
{
- typename mutex_type::scoped_lock lock(mutex);
+ unique_lock<mutex_type> lock(mutex);
shared_ptr<void> blocker = _weak_blocker.lock();
if(blocker == 0)
{
Copied: sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_nop.hpp (from r48947, /trunk/boost/detail/lwm_nop.hpp)
==============================================================================
--- /trunk/boost/detail/lwm_nop.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_nop.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -1,5 +1,5 @@
-#ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_NOP_HPP_INCLUDED
+#ifndef BOOST_SIGNALS2_LWM_NOP_HPP_INCLUDED
+#define BOOST_SIGNALS2_LWM_NOP_HPP_INCLUDED
// MS compatible compilers support #pragma once
@@ -8,30 +8,30 @@
#endif
//
-// boost/detail/lwm_nop.hpp
+// boost/signals2/detail/lwm_nop.hpp
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2008 Frank Mori Hess
//
// Distributed under 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)
//
+#include <boost/signals2/dummy_mutex.hpp>
+
namespace boost
{
-namespace detail
+namespace signals2
{
-class lightweight_mutex
+class lightweight_mutex: public dummy_mutex
{
-public:
-
- typedef lightweight_mutex scoped_lock;
};
-} // namespace detail
+} // namespace signals2
} // namespace boost
-#endif // #ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED
+#endif // #ifndef BOOST_SIGNALS2_LWM_NOP_HPP_INCLUDED
Copied: sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_pthreads.hpp (from r48947, /trunk/boost/detail/lwm_pthreads.hpp)
==============================================================================
--- /trunk/boost/detail/lwm_pthreads.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_pthreads.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -1,5 +1,5 @@
-#ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED
+#ifndef BOOST_SIGNALS2_LWM_PTHREADS_HPP_INCLUDED
+#define BOOST_SIGNALS2_LWM_PTHREADS_HPP_INCLUDED
// MS compatible compilers support #pragma once
@@ -8,9 +8,10 @@
#endif
//
-// boost/detail/lwm_pthreads.hpp
+// boost/signals2/detail/lwm_pthreads.hpp
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2008 Frank Mori Hess
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -22,7 +23,7 @@
namespace boost
{
-namespace detail
+namespace signals2
{
class lightweight_mutex
@@ -53,34 +54,24 @@
pthread_mutex_destroy(&m_);
}
- class scoped_lock;
- friend class scoped_lock;
-
- class scoped_lock
+ void lock()
{
- private:
-
- pthread_mutex_t & m_;
-
- scoped_lock(scoped_lock const &);
- scoped_lock & operator=(scoped_lock const &);
-
- public:
+ pthread_mutex_lock(&m_);
+ }
- scoped_lock(lightweight_mutex & m): m_(m.m_)
- {
- pthread_mutex_lock(&m_);
- }
+ bool try_lock()
+ {
+ return pthread_mutex_trylock(&m_) == 0;
+ }
- ~scoped_lock()
- {
- pthread_mutex_unlock(&m_);
- }
- };
+ void unlock()
+ {
+ pthread_mutex_unlock(&m_);
+ }
};
-} // namespace detail
+} // namespace signals2
} // namespace boost
-#endif // #ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED
+#endif // #ifndef BOOST_SIGNALS2_LWM_PTHREADS_HPP_INCLUDED
Copied: sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_win32_cs.hpp (from r48947, /trunk/boost/detail/lwm_win32_cs.hpp)
==============================================================================
--- /trunk/boost/detail/lwm_win32_cs.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/detail/lwm_win32_cs.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -1,5 +1,5 @@
-#ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
+#ifndef BOOST_SIGNALS2_LWM_WIN32_CS_HPP_INCLUDED
+#define BOOST_SIGNALS2_LWM_WIN32_CS_HPP_INCLUDED
// MS compatible compilers support #pragma once
@@ -8,9 +8,10 @@
#endif
//
-// boost/detail/lwm_win32_cs.hpp
+// boost/signals2/detail/lwm_win32_cs.hpp
//
// Copyright (c) 2002, 2003 Peter Dimov
+// Copyright (c) 2008 Frank Mori Hess
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -24,7 +25,7 @@
namespace boost
{
-namespace detail
+namespace signals2
{
#ifndef BOOST_USE_WINDOWS_H
@@ -75,34 +76,24 @@
DeleteCriticalSection(&cs_);
}
- class scoped_lock;
- friend class scoped_lock;
-
- class scoped_lock
+ void lock()
{
- private:
-
- lightweight_mutex & m_;
-
- scoped_lock(scoped_lock const &);
- scoped_lock & operator=(scoped_lock const &);
-
- public:
+ EnterCriticalSection(&cs_);
+ }
- explicit scoped_lock(lightweight_mutex & m): m_(m)
- {
- EnterCriticalSection(&m_.cs_);
- }
+ bool try_lock()
+ {
+ return TryEnterCriticalSection(&cs_);
+ }
- ~scoped_lock()
- {
- LeaveCriticalSection(&m_.cs_);
- }
- };
+ void unlock()
+ {
+ LeaveCriticalSection(&cs_);
+ }
};
-} // namespace detail
+} // namespace signals2
} // namespace boost
-#endif // #ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
+#endif // #ifndef BOOST_SIGNALS2_LWM_WIN32_CS_HPP_INCLUDED
Modified: sandbox/thread_safe_signals/trunk/boost/signals2/detail/signal_template.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/detail/signal_template.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/detail/signal_template.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -25,7 +25,7 @@
typename Group = int, \
typename GroupCompare = std::less<Group>, \
typename SlotFunction = BOOST_FUNCTION_N_DECL(BOOST_SIGNALS_NUM_ARGS), \
- typename ThreadingModel = signals2::auto_threaded
+ typename Mutex = signals2::lightweight_mutex
// typename R, typename T1, typename T2, ..., typename TN, typename Combiner, ...
#define BOOST_SIGNAL_TEMPLATE_DECL \
BOOST_SIGNAL_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS_NUM_ARGS), \
@@ -33,11 +33,11 @@
typename Group, \
typename GroupCompare, \
typename SlotFunction, \
- typename ThreadingModel
-// R, T1, T2, ..., TN, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel
+ typename Mutex
+// R, T1, T2, ..., TN, Combiner, Group, GroupCompare, SlotFunction, Mutex
#define BOOST_SIGNAL_TEMPLATE_INSTANTIATION \
BOOST_SIGNAL_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS_NUM_ARGS), \
- Combiner, Group, GroupCompare, SlotFunction, ThreadingModel
+ Combiner, Group, GroupCompare, SlotFunction, Mutex
namespace boost
{
@@ -56,7 +56,7 @@
private:
class slot_invoker;
typedef typename group_key<Group>::type group_key_type;
- typedef shared_ptr<connection_body<group_key_type, slot_type, ThreadingModel> > connection_body_type;
+ typedef shared_ptr<connection_body<group_key_type, slot_type, Mutex> > connection_body_type;
typedef grouped_list<Group, GroupCompare, connection_body_type> connection_list_type;
public:
typedef typename slot_function_type::result_type slot_result_type;
@@ -65,7 +65,7 @@
typedef Group group_type;
typedef GroupCompare group_compare_type;
typedef typename detail::slot_call_iterator_t<slot_invoker,
- typename connection_list_type::iterator, connection_body<group_key_type, slot_type, ThreadingModel> > slot_call_iterator;
+ typename connection_list_type::iterator, connection_body<group_key_type, slot_type, Mutex> > slot_call_iterator;
BOOST_SIGNAL_IMPL_CLASS_NAME(const combiner_type &combiner,
const group_compare_type &group_compare):
@@ -75,7 +75,7 @@
// connect slot
connection connect(const slot_type &slot, connect_position position = at_back)
{
- typename mutex_type::scoped_lock lock(_mutex);
+ unique_lock<mutex_type> lock(_mutex);
connection_body_type newConnectionBody =
create_new_connection(slot);
group_key_type group_key;
@@ -94,7 +94,7 @@
connection connect(const group_type &group,
const slot_type &slot, connect_position position = at_back)
{
- typename mutex_type::scoped_lock lock(_mutex);
+ unique_lock<Mutex> lock(_mutex);
connection_body_type newConnectionBody =
create_new_connection(slot);
// update map to first connection body in group if needed
@@ -147,7 +147,7 @@
shared_ptr<invocation_state> local_state;
typename connection_list_type::iterator it;
{
- typename mutex_type::scoped_lock listLock(_mutex);
+ unique_lock<mutex_type> listLock(_mutex);
// only clean up if it is safe to do so
if(_shared_state.unique())
nolock_cleanup_connections(false);
@@ -168,7 +168,7 @@
shared_ptr<invocation_state> local_state;
typename connection_list_type::iterator it;
{
- typename mutex_type::scoped_lock listLock(_mutex);
+ unique_lock<mutex_type> listLock(_mutex);
// only clean up if it is safe to do so
if(_shared_state.unique())
nolock_cleanup_connections(false);
@@ -211,19 +211,19 @@
}
combiner_type combiner() const
{
- typename mutex_type::scoped_lock lock(_mutex);
+ unique_lock<mutex_type> lock(_mutex);
return _shared_state->combiner;
}
void set_combiner(const combiner_type &combiner)
{
- typename mutex_type::scoped_lock lock(_mutex);
+ unique_lock<mutex_type> lock(_mutex);
if(_shared_state.unique())
_shared_state->combiner = combiner;
else
_shared_state.reset(new invocation_state(_shared_state->connection_bodies, combiner));
}
private:
- typedef typename ThreadingModel::mutex_type mutex_type;
+ typedef Mutex mutex_type;
// slot_invoker is passed to slot_call_iterator_t to run slots
class slot_invoker
@@ -288,7 +288,7 @@
{
bool connected;
{
- typename connection_body<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
+ unique_lock<Mutex> lock((*it)->mutex);
if(grab_tracked)
(*it)->nolock_slot_expired();
connected = (*it)->nolock_nograb_connected();
@@ -333,13 +333,13 @@
}
shared_ptr<invocation_state> get_readable_state() const
{
- typename mutex_type::scoped_lock listLock(_mutex);
+ unique_lock<mutex_type> listLock(_mutex);
return _shared_state;
}
connection_body_type create_new_connection(const slot_type &slot)
{
nolock_force_unique_connection_list();
- return connection_body_type(new connection_body<group_key_type, slot_type, ThreadingModel>(slot));
+ return connection_body_type(new connection_body<group_key_type, slot_type, Mutex>(slot));
}
void do_disconnect(const group_type &group, mpl::bool_<true> is_group)
{
@@ -354,7 +354,7 @@
for(it = local_state->connection_bodies.begin();
it != local_state->connection_bodies.end(); ++it)
{
- typename connection_body<group_key_type, slot_type, ThreadingModel>::mutex_type::scoped_lock lock((*it)->mutex);
+ unique_lock<Mutex> lock((*it)->mutex);
if((*it)->slot.slot_function() == slot)
{
(*it)->nolock_disconnect();
@@ -504,19 +504,19 @@
};
template<unsigned arity, typename Signature, typename Combiner,
- typename Group, typename GroupCompare, typename SlotFunction, typename ThreadingModel>
+ typename Group, typename GroupCompare, typename SlotFunction, typename Mutex>
class signalN;
// partial template specialization
template<typename Signature, typename Combiner, typename Group,
- typename GroupCompare, typename SlotFunction, typename ThreadingModel>
+ typename GroupCompare, typename SlotFunction, typename Mutex>
class signalN<BOOST_SIGNALS_NUM_ARGS, Signature, Combiner, Group,
- GroupCompare, SlotFunction, ThreadingModel>
+ GroupCompare, SlotFunction, Mutex>
{
public:
typedef BOOST_SIGNAL_CLASS_NAME<
BOOST_SIGNAL_PORTABLE_SIGNATURE(BOOST_SIGNALS_NUM_ARGS, Signature),
Combiner, Group,
- GroupCompare, SlotFunction, ThreadingModel> type;
+ GroupCompare, SlotFunction, Mutex> type;
};
} // namespace detail
} // namespace signals2
Modified: sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_call_iterator.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_call_iterator.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/detail/slot_call_iterator.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -19,6 +19,7 @@
#include <boost/scoped_ptr.hpp>
#include <boost/signals2/connection.hpp>
#include <boost/signals2/slot_base.hpp>
+#include <boost/signals2/detail/unique_lock.hpp>
#include <boost/type_traits.hpp>
#include <boost/weak_ptr.hpp>
@@ -85,7 +86,7 @@
}
private:
- typedef typename ConnectionBody::mutex_type::scoped_lock lock_type;
+ typedef unique_lock<typename ConnectionBody::mutex_type> lock_type;
void lock_next_callable() const
{
Added: sandbox/thread_safe_signals/trunk/boost/signals2/detail/unique_lock.hpp
==============================================================================
--- (empty file)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/detail/unique_lock.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -0,0 +1,42 @@
+/*
+ Provides a basic subset of boost::unique_lock functionality. Provided only because
+ including boost/thread/locks.hpp requires linking to thread library
+*/
+// Copyright Frank Mori Hess 2008.
+// Distributed under 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)
+
+// See http://www.boost.org/libs/signals2 for library home page.
+
+#ifndef BOOST_SIGNALS2_DETAIL_UNIQUE_LOCK_HEADER
+#define BOOST_SIGNALS2_DETAIL_UNIQUE_LOCK_HEADER
+
+#include <boost/noncopyable.hpp>
+
+namespace boost
+{
+ namespace signals2
+ {
+ namespace detail
+ {
+ template<typename Mutex>
+ class unique_lock: public noncopyable
+ {
+ public:
+ unique_lock(Mutex &m): _mutex(m)
+ {
+ _mutex.lock();
+ }
+ ~unique_lock()
+ {
+ _mutex.unlock();
+ }
+ private:
+ Mutex &_mutex;
+ };
+ } // namespace detail
+ } // namespace signals2
+} // namespace boost
+
+#endif // BOOST_SIGNALS2_DETAIL_UNIQUE_LOCK_HEADER
Added: sandbox/thread_safe_signals/trunk/boost/signals2/dummy_mutex.hpp
==============================================================================
--- (empty file)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/dummy_mutex.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -0,0 +1,29 @@
+// A model of the Lockable concept from Boost.Thread which
+// does nothing. It can be passed as the Mutex template parameter
+// for a signal, if the user wishes to disable thread-safety
+// (presumably for performance reasons).
+
+// Copyright Frank Mori Hess 2008.
+// Distributed under 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)
+
+// See http://www.boost.org/libs/signals2 for library home page.
+
+#ifndef BOOST_SIGNALS2_DUMMY_MUTEX_HEADER
+#define BOOST_SIGNALS2_DUMMY_MUTEX_HEADER
+
+namespace boost {
+ namespace signals2 {
+ class dummy_mutex
+ {
+ public:
+ void lock() {}
+ bool try_lock() {return true;}
+ void unlock() {}
+ };
+ } // end namespace signals2
+} // end namespace boost
+
+#endif // BOOST_SIGNALS2_DUMMY_MUTEX_HEADER
+
Copied: sandbox/thread_safe_signals/trunk/boost/signals2/lightweight_mutex.hpp (from r48947, /trunk/boost/detail/lightweight_mutex.hpp)
==============================================================================
--- /trunk/boost/detail/lightweight_mutex.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/lightweight_mutex.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -1,5 +1,5 @@
-#ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
-#define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
+#ifndef BOOST_SIGNALS2_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
+#define BOOST_SIGNALS2_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
// MS compatible compilers support #pragma once
@@ -8,35 +8,31 @@
#endif
//
-// boost/detail/lightweight_mutex.hpp - lightweight mutex
+// boost/signals2/lightweight_mutex.hpp - lightweight mutex
//
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2008 Frank Mori Hess
//
// Distributed under 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)
//
-// typedef <unspecified> boost::detail::lightweight_mutex;
-//
-// boost::detail::lightweight_mutex is a header-only implementation of
-// a subset of the Mutex concept requirements:
-//
-// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex
-//
-// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX.
+// boost::signals2::lightweight_mutex is a modification of
+// boost::detail::lightweight_mutex to follow the newer Lockable
+// concept of Boost.Thread.
//
#include <boost/config.hpp>
#if !defined(BOOST_HAS_THREADS)
-# include <boost/detail/lwm_nop.hpp>
+# include <boost/signals2/detail/lwm_nop.hpp>
#elif defined(BOOST_HAS_PTHREADS)
-# include <boost/detail/lwm_pthreads.hpp>
+# include <boost/signals2/detail/lwm_pthreads.hpp>
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
-# include <boost/detail/lwm_win32_cs.hpp>
+# include <boost/signals2/detail/lwm_win32_cs.hpp>
#else
// Use #define BOOST_DISABLE_THREADS to avoid the error
# error Unrecognized threading platform
#endif
-#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
+#endif // #ifndef BOOST_SIGNALS2_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
Deleted: sandbox/thread_safe_signals/trunk/boost/signals2/multi_threaded.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/multi_threaded.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
+++ (empty file)
@@ -1,27 +0,0 @@
-// Boost.Signals library
-
-// Copyright Frank Mori Hess 2007-2008.
-// 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>
-
-namespace boost {
- namespace signals2 {
- class multi_threaded
- {
- public:
- typedef mutex mutex_type;
- };
- } // end namespace signals2
-} // end namespace boost
-
-#endif // BOOST_SIGNALS_MULTI_THREADED_MODEL_HEADER
-
Modified: sandbox/thread_safe_signals/trunk/boost/signals2/signal.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/signal.hpp (original)
+++ sandbox/thread_safe_signals/trunk/boost/signals2/signal.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
@@ -25,15 +25,15 @@
#include <boost/preprocessor/iteration.hpp>
#include <boost/preprocessor/repetition.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/signals2/detail/unique_lock.hpp>
#include <boost/type_traits.hpp>
#include <boost/signals2/detail/signals_common.hpp>
#include <boost/signals2/detail/signals_common_macros.hpp>
#include <boost/signals2/detail/slot_groups.hpp>
#include <boost/signals2/detail/slot_call_iterator.hpp>
-#include <boost/signals2/auto_threaded.hpp>
+#include <boost/signals2/lightweight_mutex.hpp>
#include <boost/signals2/connection.hpp>
#include <boost/signals2/shared_connection_block.hpp>
-#include <boost/signals2/single_threaded.hpp>
#include <boost/signals2/slot.hpp>
#include <functional>
@@ -50,13 +50,13 @@
typename Group = int,
typename GroupCompare = std::less<Group>,
typename SlotFunction = function<Signature>,
- typename ThreadingModel = auto_threaded >
+ typename Mutex = lightweight_mutex >
class signal: public detail::signalN<function_traits<Signature>::arity,
- Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel>::type
+ Signature, Combiner, Group, GroupCompare, SlotFunction, Mutex>::type
{
private:
typedef typename detail::signalN<boost::function_traits<Signature>::arity,
- Signature, Combiner, Group, GroupCompare, SlotFunction, ThreadingModel>::type base_type;
+ Signature, Combiner, Group, GroupCompare, SlotFunction, Mutex>::type base_type;
public:
signal(const Combiner &combiner = Combiner(), const GroupCompare &group_compare = GroupCompare()):
base_type(combiner, group_compare)
Deleted: sandbox/thread_safe_signals/trunk/boost/signals2/single_threaded.hpp
==============================================================================
--- sandbox/thread_safe_signals/trunk/boost/signals2/single_threaded.hpp 2008-09-24 15:45:32 EDT (Wed, 24 Sep 2008)
+++ (empty file)
@@ -1,42 +0,0 @@
-// Boost.Signals2 library
-
-// Copyright Frank Mori Hess 2007-2008.
-// 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
-
-namespace boost {
- namespace signals2 {
- namespace detail
- {
- class null_mutex;
-
- class null_scoped_lock
- {
- public:
- null_scoped_lock(null_mutex &)
- {
- }
- };
- class null_mutex
- {
- public:
- typedef null_scoped_lock scoped_lock;
- };
- }
-
- class single_threaded
- {
- public:
- typedef detail::null_mutex mutex_type;
- };
- } // end namespace signals2
-} // end namespace boost
-
-#endif // BOOST_SIGNALS_SINGLE_THREADED_MODEL_HEADER
-
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk