1//
2// spinlock_test.cpp
3//
4// Copyright 2008 Peter Dimov
5//
6// Distributed under the Boost Software License, Version 1.0.
7// See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#include <boost/smart_ptr/detail/spinlock.hpp>
12
13// Sanity check only
14
15static boost::detail::spinlock sp = BOOST_DETAIL_SPINLOCK_INIT;
16static boost::detail::spinlock sp2 = BOOST_DETAIL_SPINLOCK_INIT;
17
18int main()
19{
20 sp.lock();
21 sp2.lock();
22 sp.unlock();
23 sp2.unlock();
24
25 {
26 boost::detail::spinlock::scoped_lock lock( sp );
27 boost::detail::spinlock::scoped_lock lock2( sp2 );
28 }
29
30 return 0;
31}
32

source code of boost/libs/smart_ptr/test/spinlock_test.cpp