|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51325 - in sandbox/synchro/boost/synchro: . conc process thread
From: vicente.botet_at_[hidden]
Date: 2009-02-18 18:16:54
Author: viboes
Date: 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
New Revision: 51325
URL: http://svn.boost.org/trac/boost/changeset/51325
Log:
Replacing by DELETE macros
Text files modified:
sandbox/synchro/boost/synchro/conc/concurrent_component.hpp | 22 +----
sandbox/synchro/boost/synchro/lockers.hpp | 7 +
sandbox/synchro/boost/synchro/null_synchronization_family.hpp | 7 +
sandbox/synchro/boost/synchro/process/locks.hpp | 130 +++++++++++++++++-----------------
sandbox/synchro/boost/synchro/process_synchronization_family.hpp | 10 +-
sandbox/synchro/boost/synchro/semaphore.hpp | 70 ++++++++++++++----
sandbox/synchro/boost/synchro/thread/locks.hpp | 152 ++++++++++++++++++++++-----------------
sandbox/synchro/boost/synchro/thread_synchronization_family.hpp | 6 +
sandbox/synchro/boost/synchro/timeout_exception.hpp | 2
9 files changed, 233 insertions(+), 173 deletions(-)
Modified: sandbox/synchro/boost/synchro/conc/concurrent_component.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/conc/concurrent_component.hpp (original)
+++ sandbox/synchro/boost/synchro/conc/concurrent_component.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -67,17 +67,7 @@
};
}
-//template <typename Lockable=boost::mutex>
class concurrent_component : public concurrent_component_base {
-#if 0
- In file included from ..\example\Histogram.cpp:11:
- ../../../boost/synchro/conc/concurrent_component.hpp:32:
- error: '*' cannot appear in a constant-expression
-
- BOOST_CONCEPT_ASSERT((LockableConcept<Lockable>));
-#endif
-public:
-
protected:
//[port
struct port {
@@ -133,8 +123,8 @@
p.accept(abs_time);
}
#endif
- semaphore accept_call_;
- semaphore until_end_;
+ binary_semaphore accept_call_;
+ binary_semaphore until_end_;
};
static void accept(port& p) {
// accept_call_.common_.post(1);
@@ -179,8 +169,8 @@
accept_call_.post();
until_end_.wait();
}
- semaphore accept_call_;
- semaphore until_end_;
+ binary_semaphore accept_call_;
+ binary_semaphore until_end_;
const concurrent_component_base* sender_;
};
static void accept(object_port& that, const concurrent_component_base* snd) {
@@ -216,8 +206,8 @@
// static void accept(object_port& that, const concurrent_component_base* snd) {
// that.accept(snd);
// }
- semaphore accept_call_;
- semaphore until_end_;
+ binary_semaphore accept_call_;
+ binary_semaphore until_end_;
// const std::type_info* type_;
};
template <typename TYPE>
Modified: sandbox/synchro/boost/synchro/lockers.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockers.hpp (original)
+++ sandbox/synchro/boost/synchro/lockers.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -25,7 +25,9 @@
{};
struct adopt_lock_t
{};
- struct throw_lock_t
+ struct throw_timeout_t
+ {};
+ struct nothrow_timeout_t
{};
@@ -34,7 +36,8 @@
const defer_lock_t defer_lock={};
const try_to_lock_t try_to_lock={};
const adopt_lock_t adopt_lock={};
- const throw_lock_t throw_lock={};
+ const throw_timeout_t throw_timeout={};
+ const nothrow_timeout_t nothrow_timeout={};
template<typename Mutex, typename ScopeTag=typename scope_tag<Mutex>::type>
class unique_locker;
Modified: sandbox/synchro/boost/synchro/null_synchronization_family.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/null_synchronization_family.hpp (original)
+++ sandbox/synchro/boost/synchro/null_synchronization_family.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -13,14 +13,15 @@
#include <boost/synchro/null_mutex.hpp>
#include <boost/synchro/null_condition.hpp>
+#include <boost/synchro/synchronization_family.hpp>
namespace boost {
namespace synchro {
//!Describes interprocess_mutex family to use with Sync frameworks
//!based on null operation synchronization objects.
-struct null_synchronization_family
-{
+template <>
+struct synchronization_family<mono_threaded_tag> {
typedef boost::synchro::null_mutex mutex_type;
typedef boost::synchro::null_mutex recursive_mutex_type;
typedef boost::synchro::null_mutex timed_mutex_type;
@@ -30,6 +31,8 @@
typedef boost::synchro::null_condition condition_any_type;
};
+typedef synchronization_family<mono_threaded_tag> null_synchronization_family;
+
}
}
Modified: sandbox/synchro/boost/synchro/process/locks.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/locks.hpp (original)
+++ sandbox/synchro/boost/synchro/process/locks.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -40,18 +40,11 @@
typedef Mutex lockable_type;
typedef multi_process_tag scope_tag_type;
typedef typename unique_lock_type<Mutex>::type base_type;
- unique_locker(unique_locker&);
-
- //explicit unique_locker(unique_locker<Mutex, scope_tag_type>&);
- //unique_locker& operator=(unique_locker&);
- //unique_locker& operator=(unique_locker<Mutex, scope_tag_type>&);
- public:
- //Non-copyable
- BOOST_COPY_CONSTRUCTOR_DELETE(unique_locker) /*< disable copy construction >*/
- BOOST_COPY_ASSIGNEMENT_DELETE(unique_locker) /*< disable copy asignement >*/
+
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(unique_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(unique_locker) /*< disable copy asignement >*/
- unique_locker(): base_type()
- {}
+ unique_locker(): base_type() {}
explicit unique_locker(Mutex& m_): base_type(m_)
{}
@@ -67,12 +60,12 @@
unique_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
{}
template<typename TimeDuration>
- unique_locker(Mutex& m_,TimeDuration const& target_time, throw_lock_t)
+ unique_locker(Mutex& m_,TimeDuration const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
lock_for(target_time);
}
- unique_locker(Mutex& m_,system_time const& target_time, throw_lock_t)
+ unique_locker(Mutex& m_,system_time const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
lock_until(target_time);
@@ -216,17 +209,15 @@
template<typename Mutex>
class try_unique_locker<Mutex,multi_process_tag>: public unique_locker<Mutex,multi_process_tag> {
//typename scope_tag<Mutex>::type == multi_process_tag
- private:
+ public:
typedef Mutex lockable_type;
typedef multi_process_tag scope_tag_type;
typedef unique_locker<Mutex,multi_process_tag> base_type;
- try_unique_locker(try_unique_locker&);
- explicit try_unique_locker(try_unique_locker<Mutex, scope_tag_type>&);
- try_unique_locker& operator=(try_unique_locker&);
- try_unique_locker& operator=(try_unique_locker<Mutex, scope_tag_type>& other);
- public:
- try_unique_locker(): base_type()
- {}
+
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(try_unique_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(try_unique_locker) /*< disable copy asignement >*/
+
+ try_unique_locker(): base_type() {}
explicit try_unique_locker(Mutex& m_): base_type(m_, boost::interprocess::defer_lock)
{
@@ -240,33 +231,45 @@
{}
try_unique_locker(Mutex& m_,try_to_lock_t): base_type(m_, boost::interprocess::try_to_lock)
{}
+
+ try_unique_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+ {}
template<typename TimeDuration>
try_unique_locker(Mutex& m_,TimeDuration const& target_time): base_type(m_, target_time)
{}
- try_unique_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+
+ try_unique_locker(nothrow_timeout_t, system_time const& target_time, Mutex& m_)
+ : base_type(m_, defer_lock)
{}
template<typename TimeDuration>
- try_unique_locker(Mutex& m_,TimeDuration const& target_time, throw_lock_t)
+ try_unique_locker(nothrow_timeout_t, TimeDuration const& target_time, Mutex& m_)
: base_type(m_, defer_lock)
- {
- this->lock_for(target_time);
- }
- try_unique_locker(Mutex& m_,system_time const& target_time, throw_lock_t)
+ {}
+
+ try_unique_locker(Mutex& m_,system_time const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
this->lock_until(target_time);
}
template<typename TimeDuration>
- try_unique_locker(TimeDuration const& target_time, Mutex& m_)
+ try_unique_locker(Mutex& m_,TimeDuration const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
this->lock_for(target_time);
}
+
try_unique_locker(system_time const& target_time, Mutex& m_)
: base_type(m_, defer_lock)
{
this->lock_until(target_time);
}
+ template<typename TimeDuration>
+ try_unique_locker(TimeDuration const& target_time, Mutex& m_)
+ : base_type(m_, defer_lock)
+ {
+ this->lock_for(target_time);
+ }
+
#ifdef BOOST_HAS_RVALUE_REFS
try_unique_locker(try_unique_locker&& other): base_type(other)
{}
@@ -399,12 +402,9 @@
typedef multi_process_tag scope_tag_type;
typedef typename shared_lock_type<Mutex>::type base_type;
- private:
- explicit shared_locker(shared_locker&);
- shared_locker& operator=(shared_locker&);
- public:
- shared_locker(): base_type()
- {}
+ shared_locker(): base_type() {}
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(shared_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(shared_locker) /*< disable copy asignement >*/
explicit shared_locker(Mutex& m_): base_type(m_)
{}
@@ -414,26 +414,44 @@
{}
shared_locker(Mutex& m_,try_to_lock_t): base_type(m_, boost::interprocess::try_to_lock)
{}
- shared_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+
+ shared_locker(Mutex& m_,system_time const& target_time)
+ : base_type(m_, target_time)
+ {}
+ template<typename TimeDuration>
+ shared_locker(Mutex& m_,TimeDuration const& target_time)
+ : base_type(m_, boost::get_system_time()+target_time)
+ {}
+
+ shared_locker(nothrow_timeout_t, system_time const& target_time,Mutex& m_)
+ : base_type(m_, boost::interprocess::defer_lock)
{}
template<typename TimeDuration>
- shared_locker(Mutex& m_,TimeDuration const& target_time): base_type(m_, boost::get_system_time()+target_time)
+ shared_locker(nothrow_timeout_t, TimeDuration const& target_time,Mutex& m_)
{}
- shared_locker(Mutex& m_,system_time const& target_time,throw_lock_t)
+
+
+ shared_locker(Mutex& m_,system_time const& target_time,throw_timeout_t)
: base_type(m_, boost::interprocess::defer_lock)
{
lock_until(target_time);
}
template<typename TimeDuration>
- shared_locker(Mutex& m_,TimeDuration const& target_time,throw_lock_t)
+ shared_locker(Mutex& m_,TimeDuration const& target_time,throw_timeout_t)
{
lock_for(target_time);
}
- shared_locker(Mutex& m_,system_time const& target_time,throw_lock_t)
+
+ shared_locker(system_time const& target_time,Mutex& m_)
: base_type(m_, boost::interprocess::defer_lock)
{
lock_until(target_time);
}
+ template<typename TimeDuration>
+ shared_locker(TimeDuration const& target_time,Mutex& m_)
+ {
+ lock_for(target_time);
+ }
shared_locker(interprocess::detail::moved_object<shared_locker<Mutex, scope_tag_type> > other)
@@ -532,22 +550,6 @@
};
-#if 0
-#ifdef BOOST_HAS_RVALUE_REFS
- template<typename Mutex, typename ScopeTag>
- void swap(shared_locker<Mutex, ScopeTag>&& lhs,shared_locker<Mutex, ScopeTag>&& rhs)
- {
- lhs.swap(rhs);
- }
-#else
- template<typename Mutex, typename ScopeTag>
- void swap(shared_locker<Mutex, ScopeTag>& lhs,shared_locker<Mutex, ScopeTag>& rhs)
- {
- lhs.swap(rhs);
- }
-#endif
-#endif
-
template<typename Mutex>
class upgrade_locker<Mutex,multi_process_tag>: public upgrade_lock_type<Mutex>::type {
//typename scope_tag<Mutex>::type == multi_process_tag
@@ -555,12 +557,10 @@
typedef Mutex lockable_type;
typedef multi_process_tag scope_tag_type;
typedef typename upgrade_lock_type<Mutex>::type base_type;
- private:
- explicit upgrade_locker(upgrade_locker&);
- upgrade_locker& operator=(upgrade_locker&);
- public:
- upgrade_locker(): base_type()
- {}
+
+ upgrade_locker(): base_type() {}
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(upgrade_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(upgrade_locker) /*< disable copy asignement >*/
explicit upgrade_locker(Mutex& m_): base_type(m_)
{
@@ -637,10 +637,10 @@
typedef Mutex lockable_type;
typedef multi_process_tag scope_tag_type;
typedef typename upgrade_to_unique_locker_type<Mutex>::type base_type;
- private:
- explicit upgrade_to_unique_locker(upgrade_to_unique_locker&);
- upgrade_to_unique_locker& operator=(upgrade_to_unique_locker&);
- public:
+
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(upgrade_to_unique_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(upgrade_to_unique_locker) /*< disable copy asignement >*/
+
explicit upgrade_to_unique_locker(upgrade_locker<Mutex, multi_process_tag>& m_): base_type(m_)
{}
~upgrade_to_unique_locker()
Modified: sandbox/synchro/boost/synchro/process_synchronization_family.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process_synchronization_family.hpp (original)
+++ sandbox/synchro/boost/synchro/process_synchronization_family.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -16,15 +16,16 @@
#include <boost/synchro/process/upgradable_mutex.hpp>
#include <boost/synchro/process/locks.hpp>
#include <boost/interprocess/sync/interprocess_condition.hpp>
+#include <boost/synchro/synchronization_family.hpp>
namespace boost {
namespace synchro {
-
//!Describes interprocess_mutex family to use with Sync framework
//!based on boost::interprocess synchronization objects.
-struct process_synchronization_family
-{
+//[process_synchronization_family
+template <>
+struct synchronization_family<multi_process_tag> {
typedef boost::synchro::interprocess_mutex mutex_type;
typedef boost::synchro::interprocess_recursive_mutex recursive_mutex_type;
typedef boost::synchro::interprocess_mutex timed_mutex_type;
@@ -34,7 +35,8 @@
typedef boost::interprocess::interprocess_condition condition_any_type;
};
+typedef synchronization_family<multi_process_tag> process_synchronization_family;
+//]
}
}
-
#endif
Modified: sandbox/synchro/boost/synchro/semaphore.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/semaphore.hpp (original)
+++ sandbox/synchro/boost/synchro/semaphore.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -26,9 +26,10 @@
//!Wraps a semaphore that can be placed in shared memory and can be
//!shared between processes. Allows timed lock tries
-template <typename Sync=thread_synchronization_family>
+template <typename ScopeTag=multi_threaded_tag>
class basic_semaphore
{
+ typedef synchronization_family<ScopeTag> Sync;
typedef typename Sync::mutex_type lockable_type;
typedef typename Sync::condition_type condition_variable;
typedef typename unique_lock_type<lockable_type>::type scoped_lock;
@@ -66,29 +67,41 @@
//!to the posted or the timeout expires. If the timeout expires, the
//!function returns false. If the semaphore is posted the function
//!returns true. If there is an error throws sem_exception
- inline bool wait_until(const system_time &abs_time);
+ inline bool try_wait_until(const system_time &abs_time);
+
template<typename TimeDuration>
- inline bool wait_for(const TimeDuration &rel_time);
+ inline bool try_wait_for(const TimeDuration &rel_time) {
+ return try_wait_until(get_system_time()+rel_time);
+ }
+
+ inline void wait_until(const system_time &abs_time) {
+ if (!try_wait_until(abs_time)) throw timeout_exception();
+ }
+
+ template<typename TimeDuration>
+ inline void wait_for(const TimeDuration &rel_time) {
+ if (!try_wait_until(rel_time)) throw timeout_exception();
+ }
/// @cond
-private:
+protected:
lockable_type m_mut;
condition_variable m_cond;
int m_count;
/// @endcond
};
-template <typename Sync>
-inline basic_semaphore<Sync>::~basic_semaphore()
+template <typename ScopeTag>
+inline basic_semaphore<ScopeTag>::~basic_semaphore()
{}
-template <typename Sync>
-inline basic_semaphore<Sync>::basic_semaphore(int initialCount)
+template <typename ScopeTag>
+inline basic_semaphore<ScopeTag>::basic_semaphore(int initialCount)
: m_mut(), m_cond(), m_count(initialCount)
{}
-template <typename Sync>
-inline void basic_semaphore<Sync>::post()
+template <typename ScopeTag>
+inline void basic_semaphore<ScopeTag>::post()
{
scoped_lock lock(m_mut);
if(m_count == 0){
@@ -97,8 +110,8 @@
++m_count;
}
-template <typename Sync>
-inline void basic_semaphore<Sync>::wait()
+template <typename ScopeTag>
+inline void basic_semaphore<ScopeTag>::wait()
{
scoped_lock lock(m_mut);
while(m_count == 0){
@@ -107,8 +120,8 @@
--m_count;
}
-template <typename Sync>
-inline bool basic_semaphore<Sync>::try_wait()
+template <typename ScopeTag>
+inline bool basic_semaphore<ScopeTag>::try_wait()
{
scoped_lock lock(m_mut);
if(m_count == 0){
@@ -118,8 +131,8 @@
return true;
}
-template <typename Sync>
-inline bool basic_semaphore<Sync>::wait_until(const system_time &abs_time)
+template <typename ScopeTag>
+inline bool basic_semaphore<ScopeTag>::try_wait_until(const system_time &abs_time)
{
scoped_lock lock(m_mut);
while(m_count == 0){
@@ -132,6 +145,31 @@
typedef basic_semaphore<> semaphore;
+template <typename ScopeTag=multi_threaded_tag>
+class basic_binary_semaphore: public basic_semaphore<ScopeTag>
+{
+ typedef synchronization_family<ScopeTag> Sync;
+ typedef typename Sync::mutex_type lockable_type;
+ typedef typename Sync::condition_type condition_variable;
+ typedef typename unique_lock_type<lockable_type>::type scoped_lock;
+public:
+ BOOST_COPY_CONSTRUCTOR_DELETE(basic_binary_semaphore) /*< disable copy construction >*/
+ BOOST_COPY_ASSIGNEMENT_DELETE(basic_binary_semaphore) /*< disable copy asignement >*/
+
+ //!Creates a semaphore with the given initial count.
+ //!exception if there is an error.*/
+ inline basic_binary_semaphore(int initialCount):basic_semaphore<ScopeTag>(initialCount>0?1:0) {};
+ inline void post()
+ {
+ scoped_lock lock(this->m_mut);
+ if(this->m_count == 0){
+ this->m_cond.notify_one();
+ ++(this->m_count);
+ }
+ }
+};
+typedef basic_binary_semaphore<> binary_semaphore;
+
}
}
Modified: sandbox/synchro/boost/synchro/thread/locks.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/thread/locks.hpp (original)
+++ sandbox/synchro/boost/synchro/thread/locks.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -42,20 +42,14 @@
template<typename Mutex>
class unique_locker<Mutex,multi_threaded_tag>: public unique_lock_type<Mutex>::type {
//typename scope_tag<Mutex>::type == multi_threaded_tag
- private:
+ public:
typedef Mutex lockable_type;
typedef multi_threaded_tag scope_tag_type;
typedef typename unique_lock_type<Mutex>::type base_type;
- //unique_locker(unique_locker&);
- //explicit unique_locker(unique_locker<Mutex, scope_tag_type>&);
- //unique_locker& operator=(unique_locker&);
- //unique_locker& operator=(unique_locker<Mutex, scope_tag_type>& other);
-
- public:
+
BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(unique_locker) /*< disable copy construction >*/
BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(unique_locker) /*< disable copy asignement >*/
- unique_locker(): base_type()
- {}
+ unique_locker(): base_type() {}
explicit unique_locker(Mutex& m_): base_type(m_)
{}
@@ -65,22 +59,34 @@
{}
unique_locker(Mutex& m_,try_to_lock_t): base_type(m_, boost::try_to_lock)
{}
+
+ unique_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+ {}
template<typename TimeDuration>
unique_locker(Mutex& m_,TimeDuration const& target_time): base_type(m_, target_time)
{}
- unique_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+
+ unique_locker(nothrow_timeout_t&, system_time const& target_time, Mutex& m_)
+ : base_type(m_, target_time)
{}
template<typename TimeDuration>
- unique_locker(Mutex& m_,TimeDuration const& target_time, throw_lock_t)
+ unique_locker(nothrow_timeout_t&, TimeDuration const& target_time, Mutex& m_)
+ : base_type(m_, target_time)
+ {}
+
+ unique_locker(Mutex& m_,system_time const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
- lock_for(target_time);
+ lock_until(target_time);
}
- unique_locker(Mutex& m_,system_time const& target_time, throw_lock_t)
+ template<typename TimeDuration>
+ unique_locker(Mutex& m_,TimeDuration const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
- lock_until(target_time);
+ lock_for(target_time);
}
+
+
template<typename TimeDuration>
unique_locker(TimeDuration const& target_time, Mutex& m_)
: base_type(m_, defer_lock)
@@ -168,8 +174,8 @@
{
return static_cast<Mutex*>(this->base_type.mutex());
}
- bool is_locking(lockable_type* l) const {
- return l==mutex();
+ bool is_locking(lockable_type* l) const {
+ return l==mutex();
} /*< strict lockers specific function >*/
template<typename TimeDuration>
@@ -197,21 +203,18 @@
friend class shared_locker<Mutex,scope_tag_type>;
friend class upgrade_locker<Mutex,scope_tag_type>;
};
-
+
template<typename Mutex>
class try_unique_locker<Mutex,multi_threaded_tag>: public unique_locker<Mutex,multi_threaded_tag> {
//typename scope_tag<Mutex>::type == multi_threaded_tag
- private:
+ public:
typedef Mutex lockable_type;
typedef multi_threaded_tag scope_tag_type;
typedef unique_locker<Mutex,multi_threaded_tag> base_type;
- //try_unique_locker(try_unique_locker&);
- explicit try_unique_locker(try_unique_locker<Mutex, scope_tag_type>&);
- //try_unique_locker& operator=(try_unique_locker&);
- try_unique_locker& operator=(try_unique_locker<Mutex, scope_tag_type>& other);
- public:
- try_unique_locker(): base_type()
- {}
+
+ try_unique_locker(): base_type() {}
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(try_unique_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(try_unique_locker) /*< disable copy asignement >*/
explicit try_unique_locker(Mutex& m_): base_type(m_, boost::defer_lock)
{ this->try_lock(); }
@@ -223,33 +226,46 @@
{}
try_unique_locker(Mutex& m_,try_to_lock_t): base_type(m_, boost::try_to_lock)
{}
+
+ try_unique_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+ {}
template<typename TimeDuration>
try_unique_locker(Mutex& m_,TimeDuration const& target_time): base_type(m_, target_time)
{}
- try_unique_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+
+ try_unique_locker(nothrow_timeout_t, system_time const& target_time, Mutex& m_)
+ : base_type(m_, target_time)
{}
template<typename TimeDuration>
- try_unique_locker(Mutex& m_,TimeDuration const& target_time, throw_lock_t)
- : base_type(m_, defer_lock)
- {
- this->lock_for(target_time);
- }
- try_unique_locker(Mutex& m_,system_time const& target_time, throw_lock_t)
+ try_unique_locker(nothrow_timeout_t, TimeDuration const& target_time, Mutex& m_)
+ : base_type(m_, target_time)
+ {}
+
+
+ try_unique_locker(Mutex& m_,system_time const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
this->lock_until(target_time);
}
template<typename TimeDuration>
- try_unique_locker(TimeDuration const& target_time, Mutex& m_)
+ try_unique_locker(Mutex& m_,TimeDuration const& target_time, throw_timeout_t)
: base_type(m_, defer_lock)
{
this->lock_for(target_time);
}
+
try_unique_locker(system_time const& target_time, Mutex& m_)
: base_type(m_, defer_lock)
{
this->lock_until(target_time);
}
+ template<typename TimeDuration>
+ try_unique_locker(TimeDuration const& target_time, Mutex& m_)
+ : base_type(m_, defer_lock)
+ {
+ this->lock_for(target_time);
+ }
+
#ifdef BOOST_HAS_RVALUE_REFS
try_unique_locker(try_unique_locker&& other): base_type(other)
{}
@@ -325,7 +341,7 @@
friend class shared_locker<Mutex,scope_tag_type>;
friend class upgrade_locker<Mutex,scope_tag_type>;
};
-
+
template<typename Mutex>
class shared_locker<Mutex,multi_threaded_tag>: public shared_lock_type<Mutex>::type {
//typename scope_tag<Mutex>::type == multi_threaded_tag
@@ -334,12 +350,9 @@
typedef multi_threaded_tag scope_tag_type;
typedef typename shared_lock_type<Mutex>::type base_type;
- private:
- explicit shared_locker(shared_locker&);
- shared_locker& operator=(shared_locker&);
- public:
- shared_locker(): base_type()
- {}
+ shared_locker(): base_type() {}
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(shared_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(shared_locker) /*< disable copy asignement >*/
explicit shared_locker(Mutex& m_): base_type(m_)
{}
@@ -349,27 +362,36 @@
{}
shared_locker(Mutex& m_,try_to_lock_t): base_type(m_, boost::try_to_lock)
{}
- shared_locker(Mutex& m_,system_time const& target_time): base_type(m_, target_time)
+
+ shared_locker(Mutex& m_,system_time const& target_time)
+ : base_type(m_, target_time)
{}
template<typename TimeDuration>
- shared_locker(Mutex& m_,TimeDuration const& target_time): base_type(m_, boost::get_system_time()+target_time)
+ shared_locker(Mutex& m_,TimeDuration const& target_time)
+ : base_type(m_, target_time)
+ {}
+
+ shared_locker(nothrow_timeout_t, system_time const& target_time, Mutex& m_)
+ : base_type(m_, target_time)
{}
- shared_locker(Mutex& m_,system_time const& target_time,throw_lock_t)
+ template<typename TimeDuration>
+ shared_locker(nothrow_timeout_t, TimeDuration const& target_time, Mutex& m_)
+ {
+ lock_for(target_time);
+ }
+
+ shared_locker(Mutex& m_,system_time const& target_time,throw_timeout_t)
: base_type(m_, boost::defer_lock)
{
lock_until(target_time);
}
template<typename TimeDuration>
- shared_locker(Mutex& m_,TimeDuration const& target_time,throw_lock_t)
+ shared_locker(Mutex& m_,TimeDuration const& target_time,throw_timeout_t)
: base_type(m_, boost::defer_lock)
{
lock_for(target_time);
}
- shared_locker(Mutex& m_,system_time const& target_time,throw_lock_t)
- : base_type(m_, boost::defer_lock)
- {
- lock_until(target_time);
- }
+
template<typename TimeDuration>
shared_locker(TimeDuration const& target_time, Mutex& m_)
{
@@ -446,10 +468,10 @@
return static_cast<Mutex*>(this->base_type.mutex());
}
- bool is_locking(lockable_type* l) const {
- return l==mutex();
+ bool is_locking(lockable_type* l) const {
+ return l==mutex();
} /*< strict lockers specific function >*/
-
+
bool try_lock_until(boost::system_time const& absolute_time)
{
return this->timed_lock(absolute_time);
@@ -495,12 +517,10 @@
typedef Mutex lockable_type;
typedef multi_threaded_tag scope_tag_type;
typedef typename upgrade_lock_type<Mutex>::type base_type;
- private:
- explicit upgrade_locker(upgrade_locker&);
- upgrade_locker& operator=(upgrade_locker&);
- public:
- upgrade_locker(): base_type()
- {}
+
+ upgrade_locker(): base_type() {}
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(upgrade_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(upgrade_locker) /*< disable copy asignement >*/
explicit upgrade_locker(Mutex& m_): base_type(m_)
{
@@ -557,8 +577,8 @@
return static_cast<Mutex*>(this->base_type.mutex());
}
- bool is_locking(lockable_type* l) const {
- return l==mutex();
+ bool is_locking(lockable_type* l) const {
+ return l==mutex();
} /*< strict lockers specific function >*/
friend class shared_locker<Mutex, scope_tag_type>;
@@ -573,10 +593,10 @@
typedef Mutex lockable_type;
typedef multi_threaded_tag scope_tag_type;
typedef typename upgrade_to_unique_locker_type<Mutex>::type base_type;
- private:
- explicit upgrade_to_unique_locker(upgrade_to_unique_locker&);
- upgrade_to_unique_locker& operator=(upgrade_to_unique_locker&);
- public:
+
+ BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(upgrade_to_unique_locker) /*< disable copy construction >*/
+ BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(upgrade_to_unique_locker) /*< disable copy asignement >*/
+
explicit upgrade_to_unique_locker(upgrade_locker<Mutex, multi_threaded_tag>& m_): base_type(m_)
{}
~upgrade_to_unique_locker()
@@ -601,8 +621,8 @@
return static_cast<Mutex*>(this->base_type.mutex());
}
- bool is_locking(lockable_type* l) const {
- return l==mutex();
+ bool is_locking(lockable_type* l) const {
+ return l==mutex();
} /*< strict lockers specific function >*/
};
Modified: sandbox/synchro/boost/synchro/thread_synchronization_family.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/thread_synchronization_family.hpp (original)
+++ sandbox/synchro/boost/synchro/thread_synchronization_family.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -16,6 +16,7 @@
#include <boost/synchro/thread/shared_mutex.hpp>
#include <boost/synchro/thread/locks.hpp>
#include <boost/thread/condition_variable.hpp>
+#include <boost/synchro/synchronization_family.hpp>
namespace boost {
namespace synchro {
@@ -24,8 +25,8 @@
//!Describes thread synchronization family to use with Sync framework
//!based on boost synchronization objects.
//[thread_synchronization_family
-struct thread_synchronization_family
-{
+template <>
+struct synchronization_family<multi_threaded_tag> {
typedef thread_mutex mutex_type;
typedef thread_recursive_mutex recursive_mutex_type;
typedef thread_timed_mutex timed_mutex_type;
@@ -35,6 +36,7 @@
typedef boost::condition_variable_any condition_type_any;
};
//]
+typedef synchronization_family<multi_threaded_tag> thread_synchronization_family;
}
Modified: sandbox/synchro/boost/synchro/timeout_exception.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/timeout_exception.hpp (original)
+++ sandbox/synchro/boost/synchro/timeout_exception.hpp 2009-02-18 18:16:52 EST (Wed, 18 Feb 2009)
@@ -21,10 +21,12 @@
timeout_exception() : std::logic_error("timeout exception") {}
};
+ #if 0
struct throw_timeout_t {};
struct nothrow_timeout_t {};
const throw_timeout_t throw_timeout ={};
const nothrow_timeout_t no_throw_timeout ={};
+ #endif
}
}
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