Boost logo

Boost Users :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2008-05-19 12:37:21


Victor Whiskey Yankee <victor.whiskey.yankee_at_[hidden]> writes:

>>>
>>> Now, how can I sleep if I am not inside a boost::thread? When I try that, I
>>> get this compile error:
>>>
>>> error: 'boost::this_thread' has not been declared
>
>> You can't not be in a thread. And that error usually means a missing include.

> You mean there is not a sleep function anywhere in boost but inside
> boost::thread? Wow...that's incredible disappointment.<br>
> Maybe with signals or condition variable by chance?<br>

> How does one sleep in main that allows milliseconds and is
> cross-platform with linux and windows xp?

boost::this_thread::sleep works in all threads, including those not started
with boost::thread, such as main.

However, you need to include the right header:

#include <boost/thread/thread.hpp>

Anthony

-- 
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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