Boost logo

Boost Users :

From: Peter Klotz (peter.klotz_at_[hidden])
Date: 2008-07-05 17:34:19


Jean-Sebastien Stoezel wrote:
> Hi,
>
> I would like to relinquish the CPU from a thread so I thought using
> boost::thread::sleep(...). However, I have no idea how to initialize its
> argument. It looks like this is a boost::system_time. How to initiliaze
> such a type so my thread waits 20ms, 100ms...!?
>
> Thanks!
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

Just use

#include <boost/thread/thread.hpp>

boost::this_thread::sleep(boost::posix_time::milliseconds(20));

Best regards, Peter.


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