Problem with boost::thread::sleep

Using Boost 1.41, MSVC 2005, Win 7 x64 (compiling 32-bit).
I was trying to set a small delay in a loop, so the loop doesn't consume all
of the processor, using boost::thread::sleep(). I tried using the example
from the threading documentation
(http://www.boost.org/doc/libs/1_41_0/doc/html/thread/time.html#thread.time.
get_system_time):
boost::thread::sleep(boost::posix_time::milliseconds(25));
I keep getting a compiler error from the line above.
Error 2 error C2664: 'boost::thread::sleep' : cannot convert
parameter 1 from
'boost::date_time::subsecond_duration

"Rob Yull"
Using Boost 1.41, MSVC 2005, Win 7 x64 (compiling 32-bit).
I was trying to set a small delay in a loop, so the loop doesn't consume all of the processor, using boost::thread::sleep(). I tried using the example from the threading documentation (http://www.boost.org/doc/libs/1_41_0/doc/html/thread/time.html#thread.time. get_system_time):
boost::thread::sleep(boost::posix_time::milliseconds(25));
Did you want boost::this_thread::sleep ?

Thank you, that worked. I should have read a little more, I just made the
assumption that this_thread::sleep and thread::sleep were basically the same
call.
-----Original Message-----
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Chard
Sent: Friday, January 08, 2010 2:15 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] Problem with boost::thread::sleep
"Rob Yull"
Using Boost 1.41, MSVC 2005, Win 7 x64 (compiling 32-bit).
I was trying to set a small delay in a loop, so the loop doesn't consume all of the processor, using boost::thread::sleep(). I tried using the example from the threading documentation
(http://www.boost.org/doc/libs/1_41_0/doc/html/thread/time.html#thread.time.
get_system_time):
boost::thread::sleep(boost::posix_time::milliseconds(25));
Did you want boost::this_thread::sleep ? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Chard
-
Rob Yull