• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
15 static boost::detail::spinlock sp = BOOST_DETAIL_SPINLOCK_INIT;
16 static boost::detail::spinlock sp2 = BOOST_DETAIL_SPINLOCK_INIT;
17 
main()18 int 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