|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51159 - sandbox/synchro/boost/synchro/thread
From: vicente.botet_at_[hidden]
Date: 2009-02-09 17:41:57
Author: viboes
Date: 2009-02-09 17:41:56 EST (Mon, 09 Feb 2009)
New Revision: 51159
URL: http://svn.boost.org/trac/boost/changeset/51159
Log:
Boost.Synchro V0.0.0
Added:
sandbox/synchro/boost/synchro/thread/lockable_scope_traits.hpp (contents, props changed)
sandbox/synchro/boost/synchro/thread/locks.hpp (contents, props changed)
sandbox/synchro/boost/synchro/thread/mutex.hpp (contents, props changed)
sandbox/synchro/boost/synchro/thread/recursive_mutex.hpp (contents, props changed)
sandbox/synchro/boost/synchro/thread/shared_mutex.hpp (contents, props changed)
Added: sandbox/synchro/boost/synchro/thread/lockable_scope_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/synchro/thread/lockable_scope_traits.hpp 2009-02-09 17:41:56 EST (Mon, 09 Feb 2009)
@@ -0,0 +1,69 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_THREAD_LOCKABLE_SCOPE_TRAITS__HPP
+#define BOOST_SYNCHRO_THREAD_LOCKABLE_SCOPE_TRAITS__HPP
+
+#include <boost/thread/locks.hpp>
+#include <boost/thread/detail/move.hpp>
+#include <boost/synchro/lockable_scope_traits.hpp>
+#include <boost/synchro/lockable_traits.hpp>
+
+namespace boost { namespace synchro {
+
+template<>
+struct scope_traits<multi_threaded_tag>
+{
+ typedef boost::lock_error lock_error;
+ template <typename T>
+ struct moved_object : boost::detail::thread_move_t<T> {
+ moved_object(T& t_): boost::detail::thread_move_t<T>(t_) {}
+ };
+ typedef boost::defer_lock_t defer_lock_t;
+ typedef boost::adopt_lock_t adopt_lock_t;
+ typedef boost::try_to_lock_t try_to_lock_t;
+
+ static const defer_lock_t& defer_lock() {return boost::defer_lock;}
+ static const adopt_lock_t& adopt_lock() {return boost::adopt_lock;}
+ static const try_to_lock_t& try_to_lock() {return boost::try_to_lock;}
+
+#if 0
+ static const defer_lock_t defer_lock;
+ static const adopt_lock_t adopt_lock;
+ static const try_to_lock_t try_to_lock;
+#endif
+
+};
+
+#if 0
+template<>
+const boost::defer_lock_t lockable_scope_traits<multi_threaded_tag>::defer_lock={};
+template<typename Lockable>
+const boost::adopt_lock_t lockable_scope_traits<multi_threaded_tag>::adopt_lock={};
+template<typename Lockable>
+const boost::try_to_lock_t lockable_scope_traits<multi_threaded_tag>::try_to_lock={};
+#endif
+
+template<typename Lockable>
+struct lockable_scope_traits<multi_threaded_tag, Lockable> : scope_traits<multi_threaded_tag>
+{
+ typedef Lockable lockable_type;
+ typedef boost::unique_lock<lockable_type> scoped_lock;
+ typedef boost::unique_lock<lockable_type> unique_lock;
+ typedef boost::shared_lock<lockable_type> shared_lock;
+ typedef boost::upgrade_lock<lockable_type> upgrade_lock;
+
+
+};
+
+}
+}
+
+#endif
Added: sandbox/synchro/boost/synchro/thread/locks.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/synchro/thread/locks.hpp 2009-02-09 17:41:56 EST (Mon, 09 Feb 2009)
@@ -0,0 +1,36 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_THREAD_LOCKS__HPP
+#define BOOST_SYNCHRO_THREAD_LOCKS__HPP
+
+
+#include <boost/thread/locks.hpp>
+#include <boost/synchro/lockable_traits.hpp>
+
+namespace boost { namespace synchro {
+
+template <typename T>
+struct lockable_type<boost::unique_lock<T> > {
+ typedef T type;
+};
+template <typename T>
+struct lockable_type<boost::shared_lock<T> > {
+ typedef T type;
+};
+template <typename T>
+struct lockable_type<boost::upgrade_lock<T> > {
+ typedef T type;
+};
+
+}
+}
+
+#endif
Added: sandbox/synchro/boost/synchro/thread/mutex.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/synchro/thread/mutex.hpp 2009-02-09 17:41:56 EST (Mon, 09 Feb 2009)
@@ -0,0 +1,105 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_THREAD_MUTEX__HPP
+#define BOOST_SYNCHRO_THREAD_MUTEX__HPP
+
+
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/condition_variable.hpp>
+#include <boost/synchro/lockable_traits.hpp>
+#include "boost/thread/thread_time.hpp"
+#include <boost/synchro/thread/lockable_scope_traits.hpp>
+
+
+namespace boost { namespace synchro {
+
+typedef boost::mutex thread_mutex;
+
+template<>
+struct timed_interface_tag<boost::mutex> {
+ typedef hasnt_timed_interface_tag type;
+};
+template<>
+struct reentrancy_tag<boost::mutex> {
+ typedef non_recursive_tag type;
+};
+template<>
+struct category_tag<boost::mutex> {
+ typedef exclusive_lock_tag type;
+};
+
+template<>
+struct scope_tag<boost::mutex> {
+ typedef multi_threaded_tag type;
+};
+
+template<>
+struct lifetime_tag<boost::mutex> {
+ typedef process_lifetime_tag type;
+};
+
+template<>
+struct naming_tag<boost::mutex> {
+ typedef anonymous_tag type;
+};
+
+template <>
+struct best_condition<boost::mutex> {
+ typedef boost::condition_variable type;
+};
+template <>
+struct best_condition_any<boost::mutex> {
+ typedef boost::condition_variable_any type;
+};
+
+typedef boost::timed_mutex thread_timed_mutex;
+
+template<>
+struct timed_interface_tag<boost::timed_mutex> {
+ typedef has_timed_interface_tag type;
+};
+template<>
+struct reentrancy_tag<boost::timed_mutex> {
+ typedef non_recursive_tag type;
+};
+template<>
+struct category_tag<boost::timed_mutex> {
+ typedef exclusive_lock_tag type;
+};
+template<>
+struct scope_tag<boost::timed_mutex> {
+ typedef multi_threaded_tag type;
+};
+
+template<>
+struct lifetime_tag<boost::timed_mutex> {
+ typedef process_lifetime_tag type;
+};
+
+template<>
+struct naming_tag<boost::timed_mutex> {
+ typedef anonymous_tag type;
+};
+
+template <>
+struct best_condition<boost::timed_mutex> {
+ typedef boost::condition_variable_any type;
+};
+template <>
+struct best_condition_any<boost::timed_mutex> {
+ typedef boost::condition_variable_any type;
+};
+
+
+}
+}
+
+#endif
Added: sandbox/synchro/boost/synchro/thread/recursive_mutex.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/synchro/thread/recursive_mutex.hpp 2009-02-09 17:41:56 EST (Mon, 09 Feb 2009)
@@ -0,0 +1,104 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_THREAD_RECURSIVE_MUTEX__HPP
+#define BOOST_SYNCHRO_THREAD_RECURSIVE_MUTEX__HPP
+
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/condition_variable.hpp>
+#include <boost/synchro/thread/lockable_scope_traits.hpp>
+#include <boost/synchro/lockable_traits.hpp>
+
+namespace boost { namespace synchro {
+
+typedef boost::recursive_mutex thread_recursive_mutex;
+
+template<>
+struct timed_interface_tag<boost::recursive_mutex> {
+ typedef hasnt_timed_interface_tag type;
+};
+
+template<>
+struct reentrancy_tag<boost::recursive_mutex> {
+ typedef recursive_tag type;
+};
+
+template<>
+struct category_tag<boost::recursive_mutex> {
+ typedef exclusive_lock_tag type;
+};
+
+template<>
+struct scope_tag<boost::recursive_mutex> {
+ typedef multi_threaded_tag type;
+};
+
+template<>
+struct lifetime_tag<boost::recursive_mutex> {
+ typedef process_lifetime_tag type;
+};
+
+template<>
+struct naming_tag<boost::recursive_mutex> {
+ typedef anonymous_tag type;
+};
+
+template <>
+struct best_condition<boost::recursive_mutex> {
+ typedef boost::condition_variable_any type;
+};
+template <>
+struct best_condition_any<boost::recursive_mutex> {
+ typedef boost::condition_variable_any type;
+};
+
+typedef boost::recursive_timed_mutex thread_recursive_timed_mutex;
+
+template<>
+struct timed_interface_tag<boost::recursive_timed_mutex> {
+ typedef has_timed_interface_tag type;
+};
+template<>
+struct reentrancy_tag<boost::recursive_timed_mutex> {
+ typedef recursive_tag type;
+};
+template<>
+struct category_tag<boost::recursive_timed_mutex> {
+ typedef exclusive_lock_tag type;
+};
+template<>
+struct scope_tag<boost::recursive_timed_mutex> {
+ typedef multi_threaded_tag type;
+};
+
+template<>
+struct lifetime_tag<boost::recursive_timed_mutex> {
+ typedef process_lifetime_tag type;
+};
+
+template<>
+struct naming_tag<boost::recursive_timed_mutex> {
+ typedef anonymous_tag type;
+};
+
+template <>
+struct best_condition<boost::recursive_timed_mutex> {
+ typedef boost::condition_variable_any type;
+};
+template <>
+struct best_condition_any<boost::recursive_timed_mutex> {
+ typedef boost::condition_variable_any type;
+};
+
+
+}
+}
+
+#endif
Added: sandbox/synchro/boost/synchro/thread/shared_mutex.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/synchro/thread/shared_mutex.hpp 2009-02-09 17:41:56 EST (Mon, 09 Feb 2009)
@@ -0,0 +1,63 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_THREAD_SHARED_MUTEX__HPP
+#define BOOST_SYNCHRO_THREAD_SHARED_MUTEX__HPP
+
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/condition_variable.hpp>
+#include <boost/synchro/lockable_traits.hpp>
+#include <boost/synchro/thread/lockable_scope_traits.hpp>
+
+namespace boost { namespace synchro {
+
+typedef boost::shared_mutex thread_shared_mutex;
+
+template<>
+struct timed_interface_tag<boost::shared_mutex> {
+ typedef has_timed_interface_tag type;
+};
+template<>
+struct reentrancy_tag<boost::shared_mutex> {
+ typedef non_recursive_tag type;
+};
+template<>
+struct category_tag<boost::shared_mutex> {
+ typedef upgradable_lock_tag type;
+};
+template<>
+struct scope_tag<boost::shared_mutex> {
+ typedef multi_threaded_tag type;
+};
+
+template<>
+struct lifetime_tag<boost::shared_mutex> {
+ typedef process_lifetime_tag type;
+};
+
+template<>
+struct naming_tag<boost::shared_mutex> {
+ typedef anonymous_tag type;
+};
+
+template <>
+struct best_condition<boost::shared_mutex> {
+ typedef boost::condition_variable_any type;
+};
+
+template <>
+struct best_condition_any<boost::shared_mutex> {
+ typedef boost::condition_variable_any type;
+};
+
+}
+}
+
+#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