5
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11
#ifndef ASIO_DETAIL_WIN_TSS_PTR_HPP
12
#define ASIO_DETAIL_WIN_TSS_PTR_HPP
14
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
16
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18
#include "asio/detail/push_options.hpp"
20
#include "asio/detail/push_options.hpp"
21
#include <boost/config.hpp>
22
#include "asio/detail/pop_options.hpp"
24
#if defined(BOOST_WINDOWS)
26
#include "asio/error.hpp"
27
#include "asio/system_error.hpp"
28
#include "asio/detail/noncopyable.hpp"
29
#include "asio/detail/socket_types.hpp"
31
#include "asio/detail/push_options.hpp"
32
#include <boost/throw_exception.hpp>
33
#include "asio/detail/pop_options.hpp"
44
enum { out_of_indexes = 0xFFFFFFFF };
46
enum { out_of_indexes = TLS_OUT_OF_INDEXES };
52
tss_key_ = ::TlsAlloc();
53
if (tss_key_ == out_of_indexes)
55
DWORD last_error = ::GetLastError();
57
asio::error_code(last_error,
58
asio::error::get_system_category()),
60
boost::throw_exception(e);
73
return static_cast<T*>(::TlsGetValue(tss_key_));
77
void operator=(T* value)
79
::TlsSetValue(tss_key_, value);
83
// Thread-specific storage to allow unlocked access to determine whether a
84
// thread is a member of the pool.
91
#endif // defined(BOOST_WINDOWS)
93
#include "asio/detail/pop_options.hpp"
95
#endif // ASIO_DETAIL_WIN_TSS_PTR_HPP