I have created a boost thread using: boost::thread thrd(&connectionThread); where connectionThread is a simple void function. This works fine, however, when I try to make it wait for some seconds, for example using:
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC);
xt.sec += 1;
boost::thread::sleep(xt); // Sleep for 1 second
The program crashes at the xtime_get line. Even when manually trying to set xt.sec it doesn't work. I've tried several other methods, but I can't seem to make it work. Is there something I'm doing wrong? Is there a easier way to achieve my goal?