| 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 | |
| 6 | #include <boost/thread/mutex.hpp> |
| 7 | boost::mutex mut; |
| 8 | void boostMutexImp1() |
| 9 | { |
| 10 | boost::mutex::scoped_lock lock(mut); |
| 11 | mut.unlock(); // A: with this X blocks |
| 12 | //lock.unlock(); // No influence if used also if before A |
| 13 | } |
| 14 | void boostMutexImp2() |
| 15 | { |
| 16 | boost::mutex::scoped_lock lock(mut); // X: blocks with A |
| 17 | } |
| 18 | int main() |
| 19 | { |
| 20 | boostMutexImp1(); |
| 21 | boostMutexImp2(); |
| 22 | return 0; |
| 23 | } |
| 24 |
