From bb4dd8289b351fae6b55e303f189127a394a1edd Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 26 Aug 2013 08:15:55 -0400 Subject: Imported Upstream version 1.51.0 --- boost/asio/detail/keyword_tss_ptr.hpp | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 boost/asio/detail/keyword_tss_ptr.hpp (limited to 'boost/asio/detail/keyword_tss_ptr.hpp') diff --git a/boost/asio/detail/keyword_tss_ptr.hpp b/boost/asio/detail/keyword_tss_ptr.hpp new file mode 100644 index 0000000000..10dd01a1f0 --- /dev/null +++ b/boost/asio/detail/keyword_tss_ptr.hpp @@ -0,0 +1,72 @@ +// +// detail/keyword_tss_ptr.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP +#define BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +template +class keyword_tss_ptr + : private noncopyable +{ +public: + // Constructor. + keyword_tss_ptr() + { + } + + // Destructor. + ~keyword_tss_ptr() + { + } + + // Get the value. + operator T*() const + { + return value_; + } + + // Set the value. + void operator=(T* value) + { + value_ = value; + } + +private: + static __thread T* value_; +}; + +template +__thread T* keyword_tss_ptr::value_; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#endif // BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP -- cgit v1.2.3