Chris@16: // Chris@16: // detail/impl/win_tss_ptr.ipp Chris@16: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Chris@16: // Chris@101: // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: Chris@16: #ifndef BOOST_ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP Chris@16: #define BOOST_ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP Chris@16: Chris@16: #if defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: # pragma once Chris@16: #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: Chris@16: #include Chris@16: Chris@16: #if defined(BOOST_ASIO_WINDOWS) Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace asio { Chris@16: namespace detail { Chris@16: Chris@16: DWORD win_tss_ptr_create() Chris@16: { Chris@16: #if defined(UNDER_CE) Chris@16: enum { out_of_indexes = 0xFFFFFFFF }; Chris@16: #else Chris@16: enum { out_of_indexes = TLS_OUT_OF_INDEXES }; Chris@16: #endif Chris@16: Chris@16: DWORD tss_key = ::TlsAlloc(); Chris@16: if (tss_key == out_of_indexes) Chris@16: { Chris@16: DWORD last_error = ::GetLastError(); Chris@16: boost::system::error_code ec(last_error, Chris@16: boost::asio::error::get_system_category()); Chris@16: boost::asio::detail::throw_error(ec, "tss"); Chris@16: } Chris@16: return tss_key; Chris@16: } Chris@16: Chris@16: } // namespace detail Chris@16: } // namespace asio Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // defined(BOOST_ASIO_WINDOWS) Chris@16: Chris@16: #endif // BOOST_ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP