$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] Is boost::this_thread::sleep_for interruption point?
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2012-07-25 19:14:58
On Mon, Jul 23, 2012 at 5:57 PM, Serg Gulko <s.gulko_at_[hidden]> wrote:
> For some reason this functionality not works for me.
Change this function:
> //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;
> }
> }
To this:
void Test::worker(int delay) {
try {
while (true) {
boost::this_thread::sleep_for(boost::chrono::milliseconds(delay));
cout << "Doing some work" << endl;
}
} catch (boost::thread_interrupted const& e) {
cout << "INTERRUPTED" << endl;
}
}