|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60748 - in sandbox/stm/branches/vbe/boost/synchro: . detail
From: vicente.botet_at_[hidden]
Date: 2010-03-21 12:54:45
Author: viboes
Date: 2010-03-21 12:54:44 EDT (Sun, 21 Mar 2010)
New Revision: 60748
URL: http://svn.boost.org/trac/boost/changeset/60748
Log:
Boost.STM/vbe: synchro
* Allow to work on windows (Don't pthread specific interfaces)
* Introduce BOOST_USES_STATIC_TSS
* cleas vector_map and vector_set so they compile with MSVC
* remove some catches that overlap with MSVC
Added:
sandbox/stm/branches/vbe/boost/synchro/static_tss.hpp (contents, props changed)
Text files modified:
sandbox/stm/branches/vbe/boost/synchro/detail/config.hpp | 2 +-
sandbox/stm/branches/vbe/boost/synchro/time.hpp | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletions(-)
Modified: sandbox/stm/branches/vbe/boost/synchro/detail/config.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/synchro/detail/config.hpp (original)
+++ sandbox/stm/branches/vbe/boost/synchro/detail/config.hpp 2010-03-21 12:54:44 EDT (Sun, 21 Mar 2010)
@@ -18,7 +18,7 @@
#include <boost/config.hpp>
#include <boost/thread/detail/platform.hpp>
-#define BOOST_STM_USES_CALL_CONTEXT 1
+//#define BOOST_STM_USES_CALL_CONTEXT 1
//-----------------------------------------------------------------------------
Added: sandbox/stm/branches/vbe/boost/synchro/static_tss.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/synchro/static_tss.hpp 2010-03-21 12:54:44 EDT (Sun, 21 Mar 2010)
@@ -0,0 +1,77 @@
+// Copyright Stefan Strasser 2010.
+// 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)
+
+
+#ifndef BOOST_SYNCHRO_STATIC_TSS_HPP
+#define BOOST_SYNCHRO_STATIC_TSS_HPP
+
+#include <boost/noncopyable.hpp>
+#include <boost/thread/tss.hpp>
+
+namespace boost {
+namespace synchro {
+
+template<class T,class Tag,bool Threads=true>
+class static_thread_specific_ptr;
+
+
+template<class T,class Tag>
+class static_thread_specific_ptr<T,Tag,true> : noncopyable{
+private:
+ static_thread_specific_ptr();
+public:
+
+#if ((__GNUC__== 3) && (__GNUC_MINOR__ > 4) || __GNUC__>= 4)
+ static void reset(T *p=0){ ptr=p; }
+ static T *get(){ return ptr; }
+private:
+ static __thread T *ptr;
+};
+
+template<class T,class Tag>
+__thread T *static_thread_specific_ptr<T,Tag,true>::ptr(0);
+
+#elif defined(BOOST_MSVC)
+ static void reset(T *p=0){ ptr=p; }
+ static T *get(){ return ptr; }
+private:
+ static __declspec(thread) T *ptr;
+};
+
+template<class T,class Tag>
+__declspec(thread) T *static_thread_specific_ptr<T,Tag,true>::ptr(0);
+
+
+#else
+ static void reset(T *p=0){ ptr.reset(p); }
+ static T *get(){ return ptr.get(); }
+private:
+ static thread_specific_ptr<T> ptr;
+};
+
+template<class T,class Tag>
+thread_specific_ptr<T> static_thread_specific_ptr<T,Tag,true>::ptr(0); //null deleter
+
+#endif
+
+template<class T,class Tag>
+class static_thread_specific_ptr<T,Tag,false> : noncopyable{
+private:
+ static_thread_specific_ptr();
+public:
+ static void reset(T *p=0){ ptr=p; }
+ static T *get(){ return ptr; }
+private:
+ static T *ptr;
+};
+
+template<class T,class Tag>
+T *static_thread_specific_ptr<T,Tag,false>::ptr(0);
+
+}
+}
+
+
+#endif
Modified: sandbox/stm/branches/vbe/boost/synchro/time.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/synchro/time.hpp (original)
+++ sandbox/stm/branches/vbe/boost/synchro/time.hpp 2010-03-21 12:54:44 EDT (Sun, 21 Mar 2010)
@@ -16,7 +16,15 @@
//-----------------------------------------------------------------------------
#include <boost/thread/thread_time.hpp>
+
+#include <boost/thread/detail/platform.hpp>
+#if defined(BOOST_THREAD_PLATFORM_WIN32)
+#elif defined(BOOST_THREAD_PLATFORM_PTHREAD)
#include <boost/thread/pthread/timespec.hpp>
+#else
+#error "Boost threads unavailable on this platform"
+#endif
+
//-----------------------------------------------------------------------------
namespace boost { namespace synchro {
@@ -27,11 +35,17 @@
return boost::get_system_time();
}
+#include <boost/thread/detail/platform.hpp>
+#if defined(BOOST_THREAD_PLATFORM_WIN32)
+#elif defined(BOOST_THREAD_PLATFORM_PTHREAD)
namespace detail {
inline struct timespec const get_timespec(system_time& t) {
return boost::detail::get_timespec(t);
}
}
+#else
+#error "Boost threads unavailable on this platform"
+#endif
}}
#endif // BOOST_SYNCHO_TRY_LOCK_HPP
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