This is Unofficial EPICS BASE Doxygen Site
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
spinlock_pool.hpp
Go to the documentation of this file.
1
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
2
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
3
4
// MS compatible compilers support #pragma once
5
6
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
7
# pragma once
8
#endif
9
10
//
11
// boost/detail/spinlock_pool.hpp
12
//
13
// Copyright (c) 2008 Peter Dimov
14
//
15
// Distributed under the Boost Software License, Version 1.0.
16
// See accompanying file LICENSE_1_0.txt or copy at
17
// http://www.boost.org/LICENSE_1_0.txt)
18
//
19
// spinlock_pool<0> is reserved for atomic<>, when/if it arrives
20
// spinlock_pool<1> is reserved for shared_ptr reference counts
21
// spinlock_pool<2> is reserved for shared_ptr atomic access
22
//
23
24
#include <
boost/config.hpp
>
25
#include <
boost/smart_ptr/detail/spinlock.hpp
>
26
#include <cstddef>
27
28
namespace
boost
29
{
30
31
namespace
detail
32
{
33
34
template
<
int
I >
class
spinlock_pool
35
{
36
private
:
37
38
static
spinlock
pool_[ 41 ];
39
40
public
:
41
42
static
spinlock
&
spinlock_for
(
void
const
*
pv
)
43
{
44
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
45
std::size_t
i
=
reinterpret_cast<
unsigned
long
long
>
( pv ) % 41;
46
#else
47
std::size_t i =
reinterpret_cast<
std::size_t
>
( pv ) % 41;
48
#endif
49
return
pool_[
i
];
50
}
51
52
class
scoped_lock
53
{
54
private
:
55
56
spinlock
& sp_;
57
58
scoped_lock
(
scoped_lock
const
& );
59
scoped_lock
& operator=(
scoped_lock
const
& );
60
61
public
:
62
63
explicit
scoped_lock
(
void
const
*
pv
): sp_(
spinlock_for
( pv ) )
64
{
65
sp_.
lock
();
66
}
67
68
~scoped_lock
()
69
{
70
sp_.
unlock
();
71
}
72
};
73
};
74
75
template
<
int
I >
spinlock
spinlock_pool< I >::pool_
[ 41 ] =
76
{
77
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
78
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
79
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
80
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
81
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
82
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
83
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
84
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
BOOST_DETAIL_SPINLOCK_INIT
,
85
BOOST_DETAIL_SPINLOCK_INIT
86
};
87
88
}
// namespace detail
89
}
// namespace boost
90
91
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
boost::detail::spinlock_pool::scoped_lock::~scoped_lock
~scoped_lock()
Definition:
spinlock_pool.hpp:68
boost
Definition:
assert.hpp:91
i
int i
Definition:
scan.c:967
pv
Definition:
tool_lib.h:67
boost::detail::spinlock::lock
void lock()
Definition:
spinlock_pt.hpp:39
boost::detail::spinlock_pool::scoped_lock::scoped_lock
scoped_lock(void const *pv)
Definition:
spinlock_pool.hpp:63
config.hpp
detail
Definition:
pvUnitTest.h:17
boost::detail::spinlock
Definition:
spinlock_pt.hpp:26
boost::detail::spinlock_pool
Definition:
spinlock_pool.hpp:34
boost::detail::spinlock::unlock
void unlock()
Definition:
spinlock_pt.hpp:44
boost::detail::spinlock_pool::scoped_lock
Definition:
spinlock_pool.hpp:52
BOOST_DETAIL_SPINLOCK_INIT
#define BOOST_DETAIL_SPINLOCK_INIT
Definition:
spinlock_pt.hpp:77
spinlock.hpp
boost::detail::spinlock_pool::spinlock_for
static spinlock & spinlock_for(void const *pv)
Definition:
spinlock_pool.hpp:42
modules
libcom
vxWorks
boost
smart_ptr
detail
spinlock_pool.hpp
Generated by
1.8.11