Boost logo

Boost Users :

Subject: Re: [Boost-users] Thread changes from Boost 1.38 to 1.45
From: Viatcheslav.Sysoltsev_at_[hidden]
Date: 2011-02-08 04:33:41


> Umm, not sure if I got you correctly: you mean one of your thread waits
> in condition_variable_any::timed_wait() and second tries to interrupt
> it, which just does not seem to make any effect? Can you write a small
> test case demonstrating your problem?

The following works as expected with boost 1.45:

#include <string>
#include <boost/thread/thread.hpp>

boost::condition_variable cond;
boost::mutex mut;

void wait_for_data_to_process()
{
     boost::unique_lock<boost::mutex> lock(mut);
     boost::xtime curTime;
     boost::xtime_get(&curTime, boost::TIME_UTC);
     curTime.sec += 10;
     cond.timed_wait(lock, curTime);
     printf("Data processed\n");
}

int main()
{
     boost::thread t(&wait_for_data_to_process);
     usleep(1000000);
     t.interrupt();
     t.join();
     return 0;
}

So you need either to explain your problem more clearly or provide the
test case demonstrating the issue.


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