spinlock_pool_test.cpp 578 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // spinlock_pool_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. #include <boost/smart_ptr/detail/spinlock_pool.hpp>
  11. // Sanity check only
  12. int main()
  13. {
  14. int x = 0;
  15. {
  16. boost::detail::spinlock_pool<0>::scoped_lock lock( &x );
  17. ++x;
  18. }
  19. {
  20. boost::detail::spinlock_pool<1>::scoped_lock lock( &x );
  21. boost::detail::spinlock_pool<2>::scoped_lock lock2( &x );
  22. }
  23. return 0;
  24. }