Boost logo

Boost Users :

Subject: Re: [Boost-users] Is boost::this_thread::sleep_for interruption point?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-05-23 01:29:15


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net