|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65391 - in sandbox/sync: . boost boost/sync boost/sync/null libs/sync/test
From: vicente.botet_at_[hidden]
Date: 2010-09-12 04:25:11
Author: viboes
Date: 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
New Revision: 65391
URL: http://svn.boost.org/trac/boost/changeset/65391
Log:
Added Boost.Sync first implementation
Added:
sandbox/sync/boost.png (contents, props changed)
sandbox/sync/boost/interprocess_sync.patch (contents, props changed)
sandbox/sync/boost/pthread_sync.patch (contents, props changed)
sandbox/sync/boost/sync/lock_options.hpp (contents, props changed)
sandbox/sync/boost/sync/lockable_concepts.hpp (contents, props changed)
sandbox/sync/boost/sync/lockable_generator.hpp (contents, props changed)
sandbox/sync/boost/sync/lockable_traits.hpp (contents, props changed)
sandbox/sync/boost/sync/null/
sandbox/sync/boost/sync/null/null_condition.hpp (contents, props changed)
sandbox/sync/boost/sync/null/null_mutex.hpp (contents, props changed)
sandbox/sync/libs/sync/test/Jamfile.v2 (contents, props changed)
sandbox/sync/libs/sync/test/lockable_concepts_test.cpp (contents, props changed)
sandbox/sync/libs/sync/test/lockable_traits_test.cpp (contents, props changed)
Added: sandbox/sync/boost.png
==============================================================================
Binary file. No diff available.
Added: sandbox/sync/boost/interprocess_sync.patch
==============================================================================
Binary file. No diff available.
Added: sandbox/sync/boost/pthread_sync.patch
==============================================================================
Binary file. No diff available.
Added: sandbox/sync/boost/sync/lock_options.hpp
==============================================================================
--- (empty file)
+++ sandbox/sync/boost/sync/lock_options.hpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,52 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright 2007 Anthony Williams
+// (C) Copyright Ion Gaztanaga 2005-2009.
+// (C) Copyright Vicente J. Botet Escriba 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying fileLICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/sync for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNC_LOCK_OPTIONS_HPP
+#define BOOST_SYNC_LOCK_OPTIONS_HPP
+
+//~ #if (defined _MSC_VER) && (_MSC_VER >= 1200)
+//~ # pragma once
+//~ #endif
+
+//~ #include <boost/sync/detail/config_begin.hpp>
+//~ #include <boost/sync/detail/workaround.hpp>
+
+//!\file
+//!Describes the lock options associated with lock constructors.
+
+namespace boost {
+
+//!Type to indicate to a mutex lock constructor that must not lock the mutex.
+struct defer_lock_t{};
+//!Type to indicate to a mutex lock constructor that must try to lock the mutex.
+struct try_to_lock_t {};
+//!Type to indicate to a mutex lock constructor that the mutex is already locked.
+struct adopt_lock_t{};
+
+//!An object indicating that the locking
+//!must be deferred.
+static const defer_lock_t defer_lock = {};
+
+//!An object indicating that a try_lock()
+//!operation must be executed.
+static const try_to_lock_t try_to_lock = {};
+
+//!An object indicating that the ownership of lockable
+//!object must be accepted by the new owner.
+static const adopt_lock_t adopt_lock = {};
+
+} // namespace boost{
+
+//~ #include <boost/sync/detail/config_end.hpp>
+
+#endif // BOOST_SYNC_LOCK_OPTIONS_HPP
Added: sandbox/sync/boost/sync/lockable_concepts.hpp
==============================================================================
--- (empty file)
+++ sandbox/sync/boost/sync/lockable_concepts.hpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,193 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_LOCKABLE_CONCEPTS_HPP
+#define BOOST_SYNCHRO_LOCKABLE_CONCEPTS_HPP
+
+#include <boost/sync/lockable_traits.hpp>
+#include <boost/date_time/posix_time/ptime.hpp>
+//~ #include <boost/chrono/duration.hpp>
+//~ #include <boost/chrono/time_point.hpp>
+
+#include <boost/concept_check.hpp>
+namespace boost { namespace sync {
+
+/**
+ * LockableConcept object supports the basic features
+ * required to delimit a critical region
+ * Supports the basic lock, unlock and try_lock functions and
+ * defines the lock traits
+ */
+
+//[LockableConcept
+template <typename Lockable>
+struct BasicLockableConcept {
+ typedef typename category<Lockable>::type category;
+ typedef typename kind<Lockable>::type kind;
+ typedef typename reentrancy<Lockable>::type reentrancy;
+ typedef typename scope<Lockable>::type scope;
+ typedef typename lifetime<Lockable>::type lifetime;
+ typedef typename naming<Lockable>::type naming;
+
+ BOOST_CONCEPT_USAGE(BasicLockableConcept) {
+ l.lock();
+ l.unlock();
+ }
+ Lockable& l;
+};
+//]
+/**
+ * LockableConcept object supports the basic features
+ * required to delimit a critical region
+ * Supports the basic lock, unlock and try_lock functions and
+ * defines the lock traits
+ */
+
+//[LockableConcept
+template <typename Lockable>
+struct TryLockableConcept {
+ BOOST_CONCEPT_ASSERT((BasicLockableConcept<Lockable>));
+
+ BOOST_CONCEPT_USAGE(TryLockableConcept) {
+ b=l.try_lock();
+ }
+ Lockable& l;
+ bool b;
+};
+//]
+/**
+ * TimedLockableConcept object extends LockableConcept
+ * with timed lock functions: try_lock_until and try_lock_for and the exception based lock_until and lock_for
+ */
+
+//[TimedLockableConcept
+template <typename Lockable>
+struct TimedLockableConcept {
+ BOOST_CONCEPT_ASSERT((TryLockableConcept<Lockable>));
+
+ BOOST_CONCEPT_USAGE(TimedLockableConcept) {
+ //~ l.lock_until(t);
+ //~ l.lock_for(d);
+ b=l.try_lock_until(t);
+ b=l.try_lock_for(d);
+ }
+ Lockable& l;
+ //~ boost::chrono::system_clock::time_point t;
+ //~ boost::chrono::system_clock::duration d;
+ boost::posix_time::ptime t;
+ boost::posix_time::time_duration d;
+ bool b;
+};
+//]
+
+
+//[ConditionLockableConcept
+template <typename Lockable>
+struct ConditionLockableConcept {
+ static bool pred();
+ BOOST_CONCEPT_ASSERT((TimedLockableConcept<Lockable>));
+ typedef typename Lockable::condition Condition;
+
+ BOOST_CONCEPT_USAGE(ConditionLockableConcept) {
+ l.lock_when(c, pred);
+ l.lock_when_until(c, pred, t);
+ l.lock_when_for(c, pred, d);
+ l.relock_on(c);
+ l.relock_on_until(c, t);
+ l.relock_on_for(c, d);
+ l.relock_when(c, pred);
+ l.relock_when_until(c, pred, t);
+ l.relock_when_for(c, pred, d);
+ c.notify_one();
+ c.notify_all();
+ }
+ Lockable& l;
+ Condition& c;
+ //~ boost::chrono::system_clock::time_point t;
+ //~ boost::chrono::system_clock::duration d;
+ boost::posix_time::ptime t;
+ boost::posix_time::time_duration d;
+};
+
+
+//]
+/**
+ * ShareLockableConcept object extends TimedLockableConcept
+ * with the lock_shared, lock_shared_until, lock_shared_for, try_lock_shared_until, try_lock_shared
+ * and unlock_shared functions
+ */
+//[ShareLockableConcept
+template <typename Lockable>
+struct ShareLockableConcept {
+ BOOST_CONCEPT_ASSERT((TimedLockableConcept<Lockable>));
+
+ BOOST_CONCEPT_USAGE(ShareLockableConcept) {
+ l.lock_shared();
+ //~ l.lock_shared_until(t);
+ //~ l.lock_shared_for(d);
+ b=l.try_lock_shared();
+ b=l.try_lock_shared_until(t);
+ b=l.try_lock_shared_for(d);
+ l.unlock_shared();
+ }
+ Lockable& l;
+ //~ boost::chrono::system_clock::time_point t;
+ //~ boost::chrono::system_clock::duration d;
+ boost::posix_time::ptime t;
+ boost::posix_time::time_duration d;
+ bool b;
+};
+//]
+
+
+/**
+ * UpgradeLockableConcept object extends SharableLockableConcept
+ * with the lock_upgrade, lock_upgrade_until, unlock_upgrade_and_lock,
+ * unlock_and_lock_shared and unlock_upgrade_and_lock_shared functions
+ */
+
+//[UpgradeLockableConcept
+
+template <typename Lockable>
+struct UpgradeLockableConcept {
+ BOOST_CONCEPT_ASSERT((ShareLockableConcept<Lockable>));
+
+ BOOST_CONCEPT_USAGE(UpgradeLockableConcept) {
+ l.lock_upgrade();
+ l.unlock_upgrade();
+ //~ l.lock_upgrade_until(t);
+ //~ l.lock_upgrade_for(d);
+ b=l.try_lock_upgrade();
+ b=l.try_lock_upgrade_until(t);
+ b=l.try_lock_upgrade_for(d);
+ l.unlock_upgrade_and_lock();
+ l.unlock_and_lock_upgrade();
+ l.unlock_and_lock_shared();
+ l.unlock_upgrade_and_lock_shared();
+ //~ b=try_unlock_upgrade_and_lock();
+ //~ b=try_unlock_upgradable_and_lock_for(d);
+ //~ b=try_unlock_upgradable_and_lock_until(t);
+ //~ b=try_unlock_share_and_lock();
+ //~ b=try_unlock_share_and_lock_upgrade();
+
+ }
+ Lockable& l;
+ //~ boost::chrono::system_clock::time_point t;
+ //~ boost::chrono::system_clock::duration d;
+ boost::posix_time::ptime t;
+ boost::posix_time::time_duration d;
+ bool b;
+
+};
+//]
+
+}
+}
+#endif
Added: sandbox/sync/boost/sync/lockable_generator.hpp
==============================================================================
--- (empty file)
+++ sandbox/sync/boost/sync/lockable_generator.hpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,223 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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/synch for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCH_LOCK_GENERATOR__HPP
+#define BOOST_SYNCH_LOCK_GENERATOR__HPP
+
+#include <boost/sync/lockable_traits.hpp>
+#include <boost/interprocess/sync/null_mutex.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/type_traits.hpp>
+
+namespace boost {
+namespace synch {
+
+template<
+ typename Scope,
+ typename Category,
+ typename Reentrancy,
+ typename Kind,
+ typename Lifetime,
+ typename Naming
+>
+struct find_best_lock;
+
+template<
+typename Lockable,
+typename Category,
+typename Scope,
+typename Reentrancy,
+typename Kind,
+typename Lifetime,
+typename Naming
+>
+struct lock_matches_features : mpl::and_<
+mpl::and_<
+ boost::is_base_and_derived<Category, typename category_tag<Lockable>::type>,
+ boost::is_base_and_derived<Scope, typename scope_tag<Lockable>::type>,
+ boost::is_base_and_derived<Reentrancy, typename reentrancy_tag<Lockable>::type> >,
+
+ boost::is_base_and_derived<Kind, typename kind<Lockable>::type>,
+ boost::is_base_and_derived<Lifetime, typename lifetime_tag<Lockable>::type>,
+ boost::is_base_and_derived<Naming, typename naming_tag<Lockable>::type>
+> {};
+
+template<
+ typename Lockables,
+ , typename constraint
+struct fill_matches_features : mpl::copy_if<Lockables, constraint>
+
+//template<
+// typename Lockables,
+// typename Lockables,
+//struct filter : mpl::and_<
+
+template<typename Scope>
+struct default_lifetime;
+
+template<>
+struct default_lifetime<multi_threaded_tag> {
+ typedef process_lifetime_tag type;
+};
+
+template<>
+struct default_lifetime<multi_process_tag> {
+ typedef kernel_lifetime_tag type;
+};
+
+
+template<
+ typename Scope=multi_threaded_tag,
+ typename Category=exclusive_lock_tag,
+ typename Reentrancy=non_recursive_tag,
+ typename Kind=timed_lockable_tag,
+ typename Lifetime=typename default_lifetime<Scope>,
+ typename Naming=anonymous_tag
+>
+struct find_best_lock;
+
+template<
+ typename Category,
+ typename Reentrancy,
+ typename Kind,
+ typename Lifetime,
+ typename Naming
+>
+struct find_best_lock<
+ mono_threaded_tag,
+ Category,
+ Reentrancy,
+ TimedInterface,
+ Lifetime,
+ Naming
+> {
+ typedef boost::interprocess::sync::null_mutex type;
+};
+
+template<>
+struct find_best_lock<
+ multi_threaded_tag,
+ exclusive_lock_tag,
+ non_recursive_tag,
+ timed_lockable_tag,
+ process_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::mutex type;
+};
+
+template<>
+struct find_best_lock<
+ multi_threaded_tag,
+ exclusive_lock_tag,
+ recursive_tag,
+ timed_lockable_tag,
+ process_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::recursive_mutex type;
+};
+
+template<>
+struct find_best_lock<
+ multi_threaded_tag,
+ exclusive_lock_tag,
+ non_recursive_tag,
+ timed_lockable_tag,
+ process_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::timed_mutex type;
+};
+
+template<>
+struct find_best_lock<
+ multi_threaded_tag,
+ exclusive_lock_tag,
+ recursive_tag,
+ timed_lockable_tag,
+ process_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::recursive_timed_mutex type;
+};
+
+template <
+ typename Category,
+ typename Kind
+>
+struct find_best_lock<
+ multi_threaded_tag,
+ Category,
+ non_recursive_tag,
+ Kind,
+ process_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::shared_mutex type;
+};
+
+//////////////////////////
+
+template <
+ typename Kind
+>
+struct find_best_lock<
+ multi_process_tag,
+ exclusive_lock_tag,
+ non_recursive_tag,
+ Kind,
+ kernel_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::interprocess::sync::interprocess_mutex type;
+};
+
+template <
+ typename Kind
+>
+struct find_best_lock<
+ multi_process_tag,
+ exclusive_lock_tag,
+ recursive_tag,
+ Kind,
+ kernel_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::interprocess::sync::interprocess_recursive_mutex type;
+};
+
+
+template <
+ typename Category,
+ typename Kind
+>
+struct find_best_lock<
+ multi_process_tag,
+ Category,
+ non_recursive_tag,
+ Kind,
+ kernel_lifetime_tag,
+ anonymous_tag
+> {
+ typedef boost::interprocess::sync::interprocess_upgradable_mutex type;
+};
+
+
+}
+}
+
+#endif
Added: sandbox/sync/boost/sync/lockable_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/sync/boost/sync/lockable_traits.hpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,382 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCH_LOCKABLE_TRAITS__HPP
+#define BOOST_SYNCH_LOCKABLE_TRAITS__HPP
+
+#include <boost/type_traits.hpp>
+#include <boost/mpl/or.hpp>
+
+namespace boost { namespace sync {
+
+namespace sync_detail {
+template <typename B, typename D>
+struct is_same_or_is_base_and_derived
+ : mpl::or_<is_same<B,D>, is_base_and_derived<B,D> >
+{};
+}
+
+/**
+ * a scope_tag forms a hierarchy
+ * mono_threaded_tag <- multi_threaded_tag <- multi_process_tag
+ */
+
+//[scope_tag_hierarchy
+struct mono_threaded_tag {};
+struct multi_threaded_tag : mono_threaded_tag {};
+struct multi_process_tag : multi_threaded_tag {};
+//]
+
+/**
+ * A lockable implementer must either
+ * inherit from the helper lockable_base or
+ * have a nested type scope or
+ * specialize the scope_tag template class
+ */
+
+//[scope_tag
+template <typename Lockable>
+struct scope {
+ typedef typename Lockable::scope type;
+};
+//]
+
+/**
+ * Inherits: If Lockable has a scope_tag that inherits from
+ * then mono_threaded_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+//[is_mono_threaded
+template <typename Lockable>
+struct is_mono_threaded
+ : sync_detail::is_same_or_is_base_and_derived<
+ mono_threaded_tag,
+ typename scope<Lockable>::type
+ >
+{};
+//]
+
+/**
+ * Inherits: If Lockable has a scope_tag that inherits from
+ * then multi_threaded_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+//[is_multi_threaded
+template <typename Lockable>
+struct is_multi_threaded
+ : sync_detail::is_same_or_is_base_and_derived<
+ multi_threaded_tag,
+ typename scope<Lockable>::type
+ >
+{};
+//]
+
+/**
+ * Inherits: If Lockable has a scope_tag that inherits from
+ * then multi_process_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+
+template <typename Lockable>
+struct is_multi_process
+ : sync_detail::is_same_or_is_base_and_derived<
+ multi_process_tag,
+ typename scope<Lockable>::type
+ >
+{};
+
+/**
+ * a lifetime_tag forms a hierarchy
+ * process_lifetime_tag <- kernel_lifetime_tag <- filesystem_lifetime_tag
+ */
+//[lifetime_tag_hierarchy
+struct process_lifetime_tag {};
+struct kernel_lifetime_tag : process_lifetime_tag {};
+struct filesystem_lifetime_tag : kernel_lifetime_tag {};
+//]
+/**
+ * A lockable implementer must either
+ * inherit from the helper lockable_base or
+ * have a nested type lifetime or
+ * specialize the lifetime_tag template class
+ */
+
+template <typename Lockable>
+struct lifetime {
+ typedef typename Lockable::lifetime type;
+};
+
+/**
+ * a naming_tags forms a hierarchy
+ * anonymous_tag <- named_tag
+ */
+
+struct anonymous_tag {};
+struct named_tag : anonymous_tag {};
+
+/**
+ * A lockable implementer must either
+ * inherit from the helper lockable_base or
+ * have a nested type naming or
+ * specialize the naming_tag template class
+ */
+
+template <typename Lockable>
+struct naming {
+ typedef typename Lockable::naming type;
+};
+
+/**
+ * a category_tag forms a hierarchy
+ * exclusive_lock_tag <- sharable_lock_tag <- upgradable_lock_tag
+ */
+//[category_tag_hierarchy
+struct exclusive_lock_tag {};
+struct sharable_lock_tag : exclusive_lock_tag {};
+struct upgradable_lock_tag : sharable_lock_tag {};
+//]
+/**
+ * A lockable implementer must either
+ * inherit from the helper lockable_base or
+ * have a nested type category or
+ * specialize the category_tag template class
+ */
+
+template <typename Lockable>
+struct category {
+ typedef typename Lockable::category type;
+};
+
+/**
+ * Inherits: If Lockable has a category_tag that inherits from
+ * then exclusive_lock_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+
+template <typename Lockable>
+struct is_exclusive_lock
+ : sync_detail::is_same_or_is_base_and_derived<
+ exclusive_lock_tag,
+ typename category<Lockable>::type
+ >
+{};
+
+/**
+ * Inherits: If Lockable has a category_tag that inherits from
+ * then sharable_lock_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+
+template <typename Lockable>
+struct is_sharable_lock
+ : sync_detail::is_same_or_is_base_and_derived<
+ sharable_lock_tag,
+ typename category<Lockable>::type
+ >
+{};
+
+/**
+ * Inherits: If Lockable has a category_tag that inherits from
+ * then upgradable_lock_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+
+template <typename Lockable>
+struct is_upgradable_lock
+ : sync_detail::is_same_or_is_base_and_derived<
+ upgradable_lock_tag,
+ typename category<Lockable>::type
+ >
+{};
+
+/**
+ * a reentrancy_tag formas a hierarchy
+ * non_recursive_tag <- recursive_tag
+ */
+//[reentrancy_tag_hierarchy
+struct non_recursive_tag {};
+struct recursive_tag : non_recursive_tag {};
+//]
+
+/**
+ * A lockable implementer must either
+ * inherit from the helper lockable_base or
+ * have a nested type reentrancy or
+ * specialize the reentrancy_tag template class
+ */
+
+template <typename Lockable>
+struct reentrancy {
+ typedef typename Lockable::reentrancy type;
+};
+
+/**
+ * Inherits: If Lockable has a reentrancy_tag that inherits from
+ * then recursive_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+template <typename Lockable>
+struct is_recursive_lock
+ : sync_detail::is_same_or_is_base_and_derived<
+ recursive_tag,
+ typename reentrancy<Lockable>::type
+ >
+{};
+
+/**
+ * a kind forms a hierarchy
+ * basic_lockable_tag <- try_lockable_tag <- timed_lockable_tag
+ */
+
+//[kind_hierarchy
+struct basic_lockable_tag {};
+struct try_lockable_tag : basic_lockable_tag {};
+struct timed_lockable_tag : try_lockable_tag {};
+//]
+/**
+ * A lockable implementer must either
+ * inherit from the helper lockable_base or
+ * have a nested type kind or
+ * specialize the kind template class
+ */
+
+template <typename Lockable>
+struct kind {
+ typedef typename Lockable::kind type;
+};
+
+/**
+ * Inherits: If Lockable has a kind that inherits from
+ * then lockable_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+
+template <typename Lockable>
+struct is_basic_lockable
+ : sync_detail::is_same_or_is_base_and_derived<
+ basic_lockable_tag,
+ typename kind<Lockable>::type
+ >
+{};
+
+/**
+ * Inherits: If Lockable has a kind that inherits from
+ * then try_lockable_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+
+template <typename Lockable>
+struct is_try_lockable
+ : sync_detail::is_same_or_is_base_and_derived<
+ try_lockable_tag,
+ typename kind<Lockable>::type
+ >
+{};
+
+/**
+ * Inherits: If Lockable has a kind that inherits from
+ * then timed_lockable_tag then inherits from true_type,
+ * otherwise inherits from false_type.
+ */
+
+template <typename Lockable>
+struct is_timed_lockable
+ : sync_detail::is_same_or_is_base_and_derived<
+ timed_lockable_tag,
+ typename kind<Lockable>::type
+ >
+{};
+
+template <typename Lockable>
+struct best_condition {
+ typedef typename Lockable::best_condition_type type;
+};
+
+template <typename Lockable>
+struct best_condition_any {
+ typedef typename Lockable::best_condition_any_type type;
+};
+
+template<typename Scope>
+struct default_lifetime;
+
+template<>
+struct default_lifetime<multi_threaded_tag> {
+ typedef process_lifetime_tag type;
+};
+
+template<>
+struct default_lifetime<multi_process_tag> {
+ typedef kernel_lifetime_tag type;
+};
+
+//[lockable_base_defaults
+template<
+ typename Scope=multi_threaded_tag,
+ typename Category=exclusive_lock_tag,
+ typename Reentrancy=non_recursive_tag,
+ typename Kind=try_lockable_tag,
+ //~ typename Lifetime=typename default_lifetime<Scope>::type,
+ typename Lifetime=process_lifetime_tag,
+ typename Naming=anonymous_tag,
+ typename Base=void
+> struct lockable_base;
+//]
+/**
+ * lockable_base is helper class that servs as a base class of lockables.
+ */
+
+//[lockable_base
+template<
+ typename Scope,
+ typename Category,
+ typename Reentrancy,
+ typename Kind,
+ typename Lifetime,
+ typename Naming,
+ typename Base
+>
+struct lockable_base : Base {
+ // TODO add constraints on typenames
+ typedef Scope scope;
+ typedef Category category;
+ typedef Reentrancy reentrancy;
+ typedef Kind kind;
+ typedef Lifetime lifetime;
+ typedef Naming naming;
+};
+//]
+
+//[lockable_base_void
+template<
+ typename Scope,
+ typename Category,
+ typename Reentrancy,
+ typename Kind,
+ typename Lifetime,
+ typename Naming
+>
+struct lockable_base<Scope, Category, Reentrancy, Kind, Lifetime, Naming, void> {
+ typedef Scope scope;
+ typedef Category category;
+ typedef Reentrancy reentrancy;
+ typedef Kind kind;
+ typedef Lifetime lifetime;
+ typedef Naming naming;
+};
+//]
+
+
+}
+}
+
+
+#endif
+
Added: sandbox/sync/boost/sync/null/null_condition.hpp
==============================================================================
--- (empty file)
+++ sandbox/sync/boost/sync/null/null_condition.hpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,84 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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/sync for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNC_NULL_CONDITION__HPP
+#define BOOST_SYNC_NULL_CONDITION__HPP
+
+//!\file
+//!Describes null_mutex class
+#include <boost/sync/null/null_mutex.hpp>
+
+namespace boost {
+
+namespace posix_time
+{ class ptime; }
+
+namespace sync {
+
+class null_condition
+{
+ //Non-copyable
+ //~ null_condition(const null_condition &); // = delete
+ //~ null_condition & opertator=(const null_condition &); // = delete
+public:
+
+ //!Constructs a null_condition. On error throws interprocess_exception.
+ null_condition(){}
+
+ //!Destroys *this
+ //!liberating system resources.
+ ~null_condition(){}
+
+ //!If there is a thread waiting on *this, change that
+ //!thread's state to ready. Otherwise there is no effect.
+ void notify_one(){}
+
+ //!Change the state of all threads waiting on *this to ready.
+ //!If there are no waiting threads, notify_all() has no effect.
+ void notify_all(){}
+
+ //!Releases the lock on the interprocess_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
+ //!this->notify_one() or this->notify_all(), and then reacquires the lock.
+ template <typename L>
+ void wait(L& lock) {}
+
+ //!The same as:
+ //!while (!pred()) wait(lock)
+ template <typename L, typename Pr>
+ void wait(L& lock, Pr pred) {}
+
+ //!Releases the lock on the interprocess_mutex object associated with lock, blocks
+ //!the current thread of execution until readied by a call to
+ //!this->notify_one() or this->notify_all(), or until time abs_time is reached,
+ //!and then reacquires the lock.
+ //!Returns: false if time abs_time is reached, otherwise true.
+
+ template <typename L>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time)
+ { return true; }
+
+ //!The same as: while (!pred()) {
+ //! if (!timed_wait(lock, abs_time)) return pred();
+ //! } return true;
+ template <typename L, typename Pr>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
+ { return true; }
+
+};
+template <>
+struct best_condition<null_mutex> {
+ typedef null_condition type;
+};
+
+}
+}
+
+#endif // __BOOST_SYNC_NULL_CONDITION__HPP
Added: sandbox/sync/boost/sync/null/null_mutex.hpp
==============================================================================
--- (empty file)
+++ sandbox/sync/boost/sync/null/null_mutex.hpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,234 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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/sync for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNC_NULL_CONDITION_HPP
+#define BOOST_SYNC_NULL_CONDITION_HPP
+
+
+#include <boost/sync/lockable_traits.hpp>
+//~ #include <boost/chrono/chrono.hpp>
+
+//!\file
+//!Describes null_mutex classes
+
+namespace boost {
+
+namespace posix_time
+{ class ptime; }
+
+namespace sync {
+class null_condition;
+//!Implements a mutex that simulates a mutex without doing any operation and
+//!simulates a successful operation.
+class null_mutex
+: public lockable_base<
+ mono_threaded_tag,
+ upgradable_lock_tag,
+ recursive_tag,
+ timed_lockable_tag, void
+>
+{
+ //~ null_mutex(const null_mutex &); // = delete
+ //~ null_mutex & opertator=(const null_mutex &); // = delete
+public:
+ typedef null_condition best_condition_type;
+ typedef null_condition best_condition_any_type;
+
+
+ //!Constructor.
+ //!Empty.
+ null_mutex(){}
+
+ //!Destructor.
+ //!Empty.
+ ~null_mutex(){}
+
+ //!Simulates a mutex lock() operation. Empty function.
+ void lock(){}
+
+ //!Simulates a mutex try_lock() operation.
+ //!Equivalent to "return true;"
+ bool try_lock()
+ { return true; }
+
+ //!Simulates a mutex timed_lock() operation.
+ //!Equivalent to "return true;"
+ bool try_lock_until(const boost::posix_time::ptime &)
+ { return true; }
+
+ //!Simulates a mutex try_lock_for() operation.
+ //!Equivalent to "return true;"
+ template<typename TimeDuration>
+ bool try_lock_for(TimeDuration const &)
+ {return true;}
+
+ //~ template<typename Clock, typename Duration>
+ //~ bool try_lock_until(chrono::time_point<Clock, Duration> const & abs_time)
+ //~ {return true;}
+
+ //~ template<typename Rep, typename Period>
+ //~ bool try_lock_for(chrono::duration<Rep, Period> const & rel_time)
+ //~ {return true;}
+
+ //!Simulates a mutex timed_lock() operation.
+ //!Equivalent to "return true;"
+ bool lock_until(const boost::posix_time::ptime &)
+ { return true; }
+
+ //!Simulates a mutex lock_for() operation.
+ //!Equivalent to "return true;"
+ template<typename TimeDuration>
+ bool lock_for(TimeDuration const &)
+ {return true;}
+
+ //~ template<typename Clock, typename Duration>
+ //~ void lock_until(chrono::time_point<Clock, Duration> const & abs_time)
+ //~ {}
+
+ //~ template<typename Rep, typename Period>
+ //~ void lock_for(chrono::duration<Rep, Period> const & rel_time)
+ //~ {}
+
+ //!Simulates a mutex unlock() operation.
+ //!Empty function.
+ void unlock(){}
+
+ //!Simulates a mutex lock_share() operation.
+ //!Empty function.
+ void lock_shared(){}
+
+ //!Simulates a mutex try_lock_share() operation.
+ //!Equivalent to "return true;"
+ bool try_lock_shared()
+ { return true; }
+
+ //!Simulates a mutex try_lock_shared_until() operation.
+ //!Equivalent to "return true;"
+ bool try_lock_shared_until(const boost::posix_time::ptime &)
+ { return true; }
+
+ //!Simulates a mutex try_lock_shared_for() operation.
+ //!Equivalent to "return true;"
+ template<typename TimeDuration>
+ bool try_lock_shared_for(const TimeDuration &)
+ { return true; }
+
+ //~ template<typename Clock, typename Duration>
+ //~ bool try_lock_shared_until(chrono::time_point<Clock, Duration> const & relative_time)
+ //~ {return true;}
+
+ //~ template<typename Rep, typename Period>
+ //~ bool try_lock_shared_for(chrono::duration<Rep, Period> const & relative_time)
+ //~ {return true;}
+
+ //!Simulates a mutex lock_shared_until() operation.
+ //!Equivalent to "return true;"
+ bool lock_shared_until(const boost::posix_time::ptime &)
+ { return true; }
+
+ //!Simulates a mutex lock_shared_for() operation.
+ //!Equivalent to "return true;"
+ template<typename TimeDuration>
+ bool lock_shared_for(const TimeDuration &)
+ { return true; }
+
+ //~ template<typename Clock, typename Duration>
+ //~ void lock_shared_until(chrono::time_point<Clock, Duration> const & relative_time)
+ //~ {}
+ //~ template<typename Rep, typename Period>
+ //~ void lock_shared_for(chrono::duration<Rep, Period> const & relative_time)
+ //~ {}
+
+ //!Simulates a mutex unlock_share() operation.
+ //!Empty function.
+ void unlock_shared(){}
+
+ //!Simulates a mutex lock_upgrade() operation.
+ //!Empty function.
+ void lock_upgrade(){}
+
+ //!Simulates a mutex try_lock_upgrade() operation.
+ //!Equivalent to "return true;"
+ bool try_lock_upgrade()
+ { return true; }
+
+ //!Simulates a mutex try_lock_upgrade_until() operation.
+ //!Equivalent to "return true;"
+ bool try_lock_upgrade_until(boost::posix_time::ptime const &)
+ { return true; }
+
+ template<typename TimeDuration>
+ bool try_lock_upgrade_for(TimeDuration const &)
+ {return true;}
+
+ //~ template<typename Clock, typename Duration>
+ //~ bool try_lock_upgrade_until(chrono::time_point<Clock, Duration> const & relative_time)
+ //~ {return true;}
+
+ //~ template<typename Rep, typename Period>
+ //~ bool try_lock_upgrade_for(chrono::duration<Rep, Period> const & relative_time)
+ //~ {return true;}
+
+ //!Simulates a mutex unlock_upgrade() operation.
+ //!Empty function.
+ void unlock_upgrade(){}
+
+ //!Simulates unlock_and_lock_upgrade().
+ //!Empty function.
+ void unlock_and_lock_upgrade(){}
+
+ //!Simulates unlock_and_lock_share().
+ //!Empty function.
+ void unlock_and_lock_shared(){}
+
+ //!Simulates unlock_upgrade_and_lock_share().
+ //!Empty function.
+ void unlock_upgrade_and_lock_shared(){}
+
+ //Promotions
+
+ //!Simulates unlock_upgrade_and_lock().
+ //!Empty function.
+ void unlock_upgrade_and_lock(){}
+
+ //!Simulates try_unlock_upgrade_and_lock().
+ //!Equivalent to "return true;"
+ bool try_unlock_upgrade_and_lock()
+ { return true; }
+
+ //!Simulates unlock_upgrade_and_lock_until().
+ //!Equivalent to "return true;"
+ bool unlock_upgrade_and_lock_until(const boost::posix_time::ptime &)
+ { return true; }
+
+ //~ template<typename Clock, typename Duration>
+ //~ bool unlock_upgrade_and_lock_until(chrono::time_point<Clock, Duration> const & relative_time)
+ //~ {return true;}
+
+ //~ template<typename Rep, typename Period>
+ //~ bool unlock_upgrade_and_lock_for(chrono::duration<Rep, Period> const & relative_time)
+ //~ {return true;}
+
+ //!Simulates try_unlock_share_and_lock().
+ //!Equivalent to "return true;"
+ bool try_unlock_share_and_lock()
+ { return true; }
+
+ //!Simulates try_unlock_share_and_lock_upgrade().
+ //!Equivalent to "return true;"
+ bool try_unlock_share_and_lock_upgrade()
+ { return true; }
+};
+
+
+}
+}
+
+#endif //BOOST_SYNC_NULL_MUTEX_HPP
Added: sandbox/sync/libs/sync/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/sync/libs/sync/test/Jamfile.v2 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,48 @@
+# Boost Sync Library test Jamfile
+
+# Copyright Beman Dawes 2003, 2006, 2008
+
+# Distributed under the Boost Software License, Version 1.0.
+# See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt
+
+# See library home page at http://www.boost.org/libs/chrono
+
+# uncomment one if the above lines if you build outside the Boost release
+#local BOOST_ROOT = /boost_1_41_0 ;
+#local BOOST_ROOT = c:/cygwin/boost_1_41_0 ;
+
+if ! $(BOOST_ROOT)
+{
+ BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
+}
+
+project
+ : requirements
+ <os>LINUX:<threading>multi
+
+ # uncomment the line above if you build outside the Boost release
+ #<include>$(BOOST_ROOT)
+ # uncomment the line above if you build outside the Boost release
+ #<include>../../..
+
+ <toolset>msvc:<asynch-exceptions>on
+ <define>BOOST_ENABLE_WARNINGS
+ <warnings>all
+ <toolset>gcc:<cxxflags>-Wextra
+ <toolset>gcc:<cxxflags>-Wno-long-long
+ <toolset>gcc-mingw-4.5.0:<cxxflags>-Wno-missing-field-initializers
+ <toolset>gcc-mingw-4.5.0:<cxxflags>-fdiagnostics-show-option
+ <toolset>msvc:<cxxflags>/wd4127
+ ;
+
+
+
+
+test-suite "lockable_traits" :
+ [ compile lockable_traits_test.cpp ]
+ ;
+
+test-suite "lockable_concepts" :
+ [ compile lockable_concepts_test.cpp ]
+ ;
+
Added: sandbox/sync/libs/sync/test/lockable_concepts_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/sync/libs/sync/test/lockable_concepts_test.cpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,107 @@
+/* Copyright 2008-2009 Vicente J. Botet Escriba
+ * 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/luid for library home page.
+ */
+
+#include <boost/sync/lockable_traits.hpp>
+#include <boost/sync/lockable_concepts.hpp>
+//~ #include <boost/sync/lockable_adapter.hpp>
+//~ #include <boost/sync/poly/lock_adapter.hpp>
+
+#if 0
+#include <boost/sync/null_mutex.hpp>
+#include <boost/sync/null_condition.hpp>
+
+#include <boost/sync/thread/mutex.hpp>
+#include <boost/sync/thread/recursive_mutex.hpp>
+#include <boost/sync/thread/shared_mutex.hpp>
+
+#include <boost/sync/process/mutex.hpp>
+#include <boost/sync/process/recursive_mutex.hpp>
+#include <boost/sync/process/upgradable_mutex.hpp>
+#include <boost/sync/process/named_mutex.hpp>
+#include <boost/sync/process/named_recursive_mutex.hpp>
+#include <boost/sync/process/named_upgradable_mutex.hpp>
+#else
+#include <boost/sync/null/null_mutex.hpp>
+#include <boost/sync/null/null_condition.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
+#include <boost/interprocess/sync/named_mutex.hpp>
+#include <boost/interprocess/sync/named_recursive_mutex.hpp>
+#include <boost/interprocess/sync/named_upgradable_mutex.hpp>
+#endif
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+
+#define BOOST_TEST_MODULE sync_lockable_concepts_test
+
+using namespace boost;
+using namespace boost::sync;
+using namespace boost::interprocess;
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<sync::null_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<sync::null_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<sync::null_mutex>));
+BOOST_CONCEPT_ASSERT((ShareLockableConcept<sync::null_mutex>));
+BOOST_CONCEPT_ASSERT((UpgradeLockableConcept<sync::null_mutex>));
+
+//~ BOOST_CONCEPT_ASSERT((TryLockableConcept<exclusive_lockable_adapter<null_mutex> >));
+//~ BOOST_CONCEPT_ASSERT((TimedLockableConcept<timed_lockable_adapter<null_mutex> >));
+//~ BOOST_CONCEPT_ASSERT((ShareLockableConcept<shared_lockable_adapter<null_mutex> >));
+//~ BOOST_CONCEPT_ASSERT((UpgradeLockableConcept<upgrade_lockable_adapter<null_mutex> >));
+
+//~ BOOST_CONCEPT_ASSERT((TryLockableConcept<poly::exclusive_lock_adapter<null_mutex> >));
+//~ BOOST_CONCEPT_ASSERT((TimedLockableConcept<poly::timed_lock_adapter<null_mutex> >));
+//~ BOOST_CONCEPT_ASSERT((ShareLockableConcept<poly::sharable_lock_adapter<null_mutex> >));
+//~ BOOST_CONCEPT_ASSERT((UpgradeLockableConcept<poly::upgradable_lock_adapter<null_mutex> >));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<boost::mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<boost::mutex>));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<boost::timed_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<boost::timed_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<boost::timed_mutex>));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<boost::recursive_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<boost::recursive_mutex>));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<boost::recursive_timed_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<boost::recursive_timed_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<boost::recursive_timed_mutex>));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<boost::shared_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<boost::shared_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<boost::shared_mutex>));
+BOOST_CONCEPT_ASSERT((ShareLockableConcept<boost::shared_mutex>));
+BOOST_CONCEPT_ASSERT((UpgradeLockableConcept<boost::shared_mutex>));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<interprocess_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<interprocess_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<interprocess_mutex>));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<interprocess_recursive_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<interprocess_recursive_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<interprocess_recursive_mutex>));
+
+BOOST_CONCEPT_ASSERT((BasicLockableConcept<named_mutex>));
+BOOST_CONCEPT_ASSERT((TryLockableConcept<named_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<named_mutex>));
+
+BOOST_CONCEPT_ASSERT((TryLockableConcept<interprocess_upgradable_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<interprocess_upgradable_mutex>));
+BOOST_CONCEPT_ASSERT((ShareLockableConcept<interprocess_upgradable_mutex>));
+BOOST_CONCEPT_ASSERT((UpgradeLockableConcept<interprocess_upgradable_mutex>));
+
+BOOST_CONCEPT_ASSERT((TryLockableConcept<named_upgradable_mutex>));
+BOOST_CONCEPT_ASSERT((TimedLockableConcept<named_upgradable_mutex>));
+BOOST_CONCEPT_ASSERT((ShareLockableConcept<named_upgradable_mutex>));
+BOOST_CONCEPT_ASSERT((UpgradeLockableConcept<named_upgradable_mutex>));
+
Added: sandbox/sync/libs/sync/test/lockable_traits_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/sync/libs/sync/test/lockable_traits_test.cpp 2010-09-12 04:25:08 EDT (Sun, 12 Sep 2010)
@@ -0,0 +1,147 @@
+/* Copyright 2008-2009 Vicente J. Botet Escriba
+ * 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/luid for library home page.
+ */
+
+
+
+
+#include <boost/sync/lockable_traits.hpp>
+#if 0
+#include <boost/sync/null_mutex.hpp>
+#include <boost/sync/null_condition.hpp>
+
+#include <boost/sync/thread/mutex.hpp>
+#include <boost/sync/thread/recursive_mutex.hpp>
+#include <boost/sync/thread/shared_mutex.hpp>
+
+#include <boost/sync/process/mutex.hpp>
+#include <boost/sync/process/recursive_mutex.hpp>
+#include <boost/sync/process/upgradable_mutex.hpp>
+#include <boost/sync/process/named_mutex.hpp>
+#include <boost/sync/process/named_recursive_mutex.hpp>
+#include <boost/sync/process/named_upgradable_mutex.hpp>
+#else
+#include <boost/sync/null/null_mutex.hpp>
+#include <boost/sync/null/null_condition.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
+#include <boost/interprocess/sync/named_mutex.hpp>
+#include <boost/interprocess/sync/named_recursive_mutex.hpp>
+#include <boost/interprocess/sync/named_upgradable_mutex.hpp>
+#endif
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+
+#define BOOST_TEST_MODULE sync_lock_traits_test
+
+using namespace boost;
+using namespace boost::sync;
+using namespace boost::interprocess;
+
+
+BOOST_STATIC_ASSERT((is_same<best_condition<sync::null_mutex>::type, null_condition>::value));
+BOOST_STATIC_ASSERT((is_same<scope<sync::null_mutex>::type, mono_threaded_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<sync::null_mutex>::type, upgradable_lock_tag>::value));
+BOOST_STATIC_ASSERT((is_same<reentrancy<sync::null_mutex>::type, recursive_tag>::value));
+BOOST_STATIC_ASSERT((is_same<kind<sync::null_mutex>::type, timed_lockable_tag>::value));
+BOOST_STATIC_ASSERT((is_exclusive_lock<sync::null_mutex>::value));
+BOOST_STATIC_ASSERT((is_sharable_lock<sync::null_mutex>::value));
+BOOST_STATIC_ASSERT((is_upgradable_lock<sync::null_mutex>::value));
+BOOST_STATIC_ASSERT((is_mono_threaded<sync::null_mutex>::value));
+BOOST_STATIC_ASSERT((!is_multi_threaded<sync::null_mutex>::value));
+BOOST_STATIC_ASSERT((!is_multi_process<sync::null_mutex>::value));
+BOOST_STATIC_ASSERT((is_recursive_lock<sync::null_mutex>::value));
+BOOST_STATIC_ASSERT((is_timed_lockable<sync::null_mutex>::value));
+
+//~ BOOST_STATIC_ASSERT((is_same<best_condition<mutex>::type, boost::condition_variable>::value));
+BOOST_STATIC_ASSERT((is_same<scope<mutex>::type, multi_threaded_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<mutex>::type, exclusive_lock_tag>::value));
+BOOST_STATIC_ASSERT((!is_recursive_lock<mutex>::value));
+BOOST_STATIC_ASSERT((is_same<kind<mutex>::type, try_lockable_tag>::value));
+BOOST_STATIC_ASSERT((is_exclusive_lock<mutex>::value));
+BOOST_STATIC_ASSERT((!is_sharable_lock<mutex>::value));
+BOOST_STATIC_ASSERT((!is_upgradable_lock<mutex>::value));
+BOOST_STATIC_ASSERT((is_mono_threaded<mutex>::value));
+BOOST_STATIC_ASSERT((is_multi_threaded<mutex>::value));
+BOOST_STATIC_ASSERT((!is_multi_process<mutex>::value));
+BOOST_STATIC_ASSERT((!is_recursive_lock<mutex>::value));
+BOOST_STATIC_ASSERT((!is_timed_lockable<mutex>::value));
+
+
+BOOST_STATIC_ASSERT((is_same<scope<timed_mutex>::type, multi_threaded_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<timed_mutex>::type, exclusive_lock_tag>::value));
+BOOST_STATIC_ASSERT((is_same<reentrancy<timed_mutex>::type, non_recursive_tag>::value));
+BOOST_STATIC_ASSERT((is_same<kind<timed_mutex>::type, timed_lockable_tag>::value));
+BOOST_STATIC_ASSERT((is_exclusive_lock<timed_mutex>::value));
+BOOST_STATIC_ASSERT((!is_sharable_lock<timed_mutex>::value));
+BOOST_STATIC_ASSERT((!is_upgradable_lock<timed_mutex>::value));
+BOOST_STATIC_ASSERT((is_mono_threaded<timed_mutex>::value));
+BOOST_STATIC_ASSERT((is_multi_threaded<timed_mutex>::value));
+BOOST_STATIC_ASSERT((!is_multi_process<timed_mutex>::value));
+BOOST_STATIC_ASSERT((!is_recursive_lock<timed_mutex>::value));
+BOOST_STATIC_ASSERT((is_timed_lockable<timed_mutex>::value));
+
+BOOST_STATIC_ASSERT((is_same<scope<recursive_mutex>::type, multi_threaded_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<recursive_mutex>::type, exclusive_lock_tag>::value));
+BOOST_STATIC_ASSERT((is_same<reentrancy<recursive_mutex>::type, recursive_tag>::value));
+BOOST_STATIC_ASSERT((is_same<kind<recursive_mutex>::type, try_lockable_tag>::value));
+BOOST_STATIC_ASSERT((is_exclusive_lock<recursive_mutex>::value));
+BOOST_STATIC_ASSERT((!is_sharable_lock<recursive_mutex>::value));
+BOOST_STATIC_ASSERT((!is_upgradable_lock<recursive_mutex>::value));
+BOOST_STATIC_ASSERT((is_mono_threaded<recursive_mutex>::value));
+BOOST_STATIC_ASSERT((is_multi_threaded<recursive_mutex>::value));
+BOOST_STATIC_ASSERT((!is_multi_process<recursive_mutex>::value));
+BOOST_STATIC_ASSERT((is_recursive_lock<recursive_mutex>::value));
+BOOST_STATIC_ASSERT((!is_timed_lockable<recursive_mutex>::value));
+
+BOOST_STATIC_ASSERT((is_same<scope<recursive_timed_mutex>::type, multi_threaded_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<recursive_timed_mutex>::type, exclusive_lock_tag>::value));
+
+BOOST_STATIC_ASSERT((is_same<scope<shared_mutex>::type, multi_threaded_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<shared_mutex>::type, upgradable_lock_tag>::value));
+BOOST_STATIC_ASSERT((is_exclusive_lock<shared_mutex>::value));
+BOOST_STATIC_ASSERT((is_sharable_lock<shared_mutex>::value));
+BOOST_STATIC_ASSERT((is_upgradable_lock<shared_mutex>::value));
+BOOST_STATIC_ASSERT((is_mono_threaded<shared_mutex>::value));
+BOOST_STATIC_ASSERT((is_multi_threaded<shared_mutex>::value));
+BOOST_STATIC_ASSERT((!is_multi_process<shared_mutex>::value));
+
+BOOST_STATIC_ASSERT((is_same<scope<interprocess_mutex>::type, multi_process_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<interprocess_mutex>::type, exclusive_lock_tag>::value));
+BOOST_STATIC_ASSERT((is_exclusive_lock<interprocess_mutex>::value));
+BOOST_STATIC_ASSERT((!is_sharable_lock<interprocess_mutex>::value));
+BOOST_STATIC_ASSERT((!is_upgradable_lock<interprocess_mutex>::value));
+BOOST_STATIC_ASSERT((is_mono_threaded<interprocess_mutex>::value));
+BOOST_STATIC_ASSERT((is_multi_threaded<interprocess_mutex>::value));
+BOOST_STATIC_ASSERT((is_multi_process<interprocess_mutex>::value));
+
+BOOST_STATIC_ASSERT((is_same<scope<interprocess_recursive_mutex>::type, multi_process_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<interprocess_recursive_mutex>::type, exclusive_lock_tag>::value));
+
+BOOST_STATIC_ASSERT((is_same<scope<named_mutex>::type, multi_process_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<named_mutex>::type, exclusive_lock_tag>::value));
+
+
+BOOST_STATIC_ASSERT((is_same<scope<interprocess_upgradable_mutex>::type, multi_process_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<interprocess_upgradable_mutex>::type, upgradable_lock_tag>::value));
+
+BOOST_STATIC_ASSERT((is_same<scope<named_upgradable_mutex>::type, multi_process_tag>::value));
+BOOST_STATIC_ASSERT((is_same<category<named_upgradable_mutex>::type, upgradable_lock_tag>::value));
+
+
+
+
+//____________________________________________________________________________//
+
+
+//____________________________________________________________________________//
+
+// EOF
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