test_8455.cpp 580 B

1234567891011121314151617181920212223
  1. // Copyright (C) 2013 Vicente Botet
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/thread/mutex.hpp>
  6. boost::mutex mut;
  7. void boostMutexImp1()
  8. {
  9. boost::mutex::scoped_lock lock(mut);
  10. mut.unlock(); // A: with this X blocks
  11. //lock.unlock(); // No influence if used also if before A
  12. }
  13. void boostMutexImp2()
  14. {
  15. boost::mutex::scoped_lock lock(mut); // X: blocks with A
  16. }
  17. int main()
  18. {
  19. boostMutexImp1();
  20. boostMutexImp2();
  21. return 0;
  22. }