Realistic 3D camera system
3D camera system components
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
asio-1.10.6
include
asio
detail
win_tss_ptr.hpp
Go to the documentation of this file.
1
//
2
// detail/win_tss_ptr.hpp
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 ASIO_DETAIL_WIN_TSS_PTR_HPP
12
#define ASIO_DETAIL_WIN_TSS_PTR_HPP
13
14
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15
# pragma once
16
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18
#include "
asio/detail/config.hpp
"
19
20
#if defined(ASIO_WINDOWS)
21
22
#include "
asio/detail/noncopyable.hpp
"
23
#include "
asio/detail/socket_types.hpp
"
24
25
#include "
asio/detail/push_options.hpp
"
26
27
namespace
asio
{
28
namespace
detail {
29
30
// Helper function to create thread-specific storage.
31
ASIO_DECL
DWORD win_tss_ptr_create();
32
33
template
<
typename
T>
34
class
win_tss_ptr
35
:
private
noncopyable
36
{
37
public
:
38
// Constructor.
39
win_tss_ptr()
40
: tss_key_(win_tss_ptr_create())
41
{
42
}
43
44
// Destructor.
45
~win_tss_ptr()
46
{
47
::TlsFree(tss_key_);
48
}
49
50
// Get the value.
51
operator
T*()
const
52
{
53
return
static_cast<
T*
>
(::TlsGetValue(tss_key_));
54
}
55
56
// Set the value.
57
void
operator=(T* value)
58
{
59
::TlsSetValue(tss_key_, value);
60
}
61
62
private
:
63
// Thread-specific storage to allow unlocked access to determine whether a
64
// thread is a member of the pool.
65
DWORD tss_key_;
66
};
67
68
}
// namespace detail
69
}
// namespace asio
70
71
#include "
asio/detail/pop_options.hpp
"
72
73
#if defined(ASIO_HEADER_ONLY)
74
# include "
asio/detail/impl/win_tss_ptr.ipp
"
75
#endif // defined(ASIO_HEADER_ONLY)
76
77
#endif // defined(ASIO_WINDOWS)
78
79
#endif // ASIO_DETAIL_WIN_TSS_PTR_HPP
config.hpp
push_options.hpp
pop_options.hpp
noncopyable.hpp
ASIO_DECL
#define ASIO_DECL
Definition:
config.hpp:43
socket_types.hpp
win_tss_ptr.ipp
asio
Definition:
async_result.hpp:23
Generated by
1.8.11