// Copyright (C) 2010 Vicente Botet // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #define BOOST_THREAD_VERSION 2 #include #include #include #include boost::shared_mutex mutex; void thread() { std::cout << __FILE__ << ":" << __LINE__ << std::endl; BOOST_TRY { for (int i =0; i<10; ++i) { #if 0 boost::system_time timeout = boost::get_system_time() + boost::posix_time::milliseconds(50); if (mutex.timed_lock(timeout)) { std::cout << __FILE__ << ":" << __LINE__ << " i="<join(); std::cout << __FILE__ << ":" << __LINE__ << std::endl; delete threads[i]; } std::cout << __FILE__ << ":" << __LINE__ << std::endl; return 0; }