Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / detail / impl / win_tss_ptr.ipp @ 2486

History | View | Annotate | Download (1.4 kB)

1
//
2
// detail/impl/win_tss_ptr.ipp
3
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
//
5
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6
//
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)
9
//
10

    
11
#ifndef BOOST_ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP
12
#define BOOST_ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP
13

    
14
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15
# pragma once
16
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17

    
18
#include <boost/asio/detail/config.hpp>
19

    
20
#if defined(BOOST_ASIO_WINDOWS)
21

    
22
#include <boost/asio/detail/throw_error.hpp>
23
#include <boost/asio/detail/win_tss_ptr.hpp>
24
#include <boost/asio/error.hpp>
25

    
26
#include <boost/asio/detail/push_options.hpp>
27

    
28
namespace boost {
29
namespace asio {
30
namespace detail {
31

    
32
DWORD win_tss_ptr_create()
33
{
34
#if defined(UNDER_CE)
35
  enum { out_of_indexes = 0xFFFFFFFF };
36
#else
37
  enum { out_of_indexes = TLS_OUT_OF_INDEXES };
38
#endif
39

    
40
  DWORD tss_key = ::TlsAlloc();
41
  if (tss_key == out_of_indexes)
42
  {
43
    DWORD last_error = ::GetLastError();
44
    boost::system::error_code ec(last_error,
45
        boost::asio::error::get_system_category());
46
    boost::asio::detail::throw_error(ec, "tss");
47
  }
48
  return tss_key;
49
}
50

    
51
} // namespace detail
52
} // namespace asio
53
} // namespace boost
54

    
55
#include <boost/asio/detail/pop_options.hpp>
56

    
57
#endif // defined(BOOST_ASIO_WINDOWS)
58

    
59
#endif // BOOST_ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP