Le 24/07/12 02:57, Serg Gulko a écrit :
Hello!
According to documentation(v 1.50.0) call boost::this_thread::sleep_for can be interrupted. For some reason this functionality not works for me. Here is code sample:
//Simple thread function void Test::worker(int delay) { try { boost::this_thread::sleep_for(boost::chrono::milliseconds(delay)); cout << "Doing some work" << endl; } catch (boost::thread_interrupted const& e) { cout << "INTERRUPTED" << endl; } }
//Far in the code
boost::thread workerThread(boost::bind(&Test::worker, this, 1200)); boost::this_thread::sleep(boost::posix_time::milliseconds(30)); workerThread.interrupt(); boost::this_thread::sleep(boost::posix_time::milliseconds(1500));
I always getting 'Doing some work'...
Hi, No you should be right, I remember that there were a ticket related that is closed now https://svn.boost.org/trac/boost/ticket/7238. Best, Vicente