
22 Feb
2009
22 Feb
'09
2:46 p.m.
Sinceboost contains no sleep/wake functionality
Ashley ! Boost threads have sleep functionality. See the following example. #include <boost/thread.hpp> #include <iostream> void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } void thread() { for (int i = 0; i < 5; ++i) { wait(1); std::cout << i << std::endl; } } int main() { boost::thread t(thread); t.join(); } If you will use join(); your main method will automatically wait for thread to complete it's execution. You can also use Mutex for synchronization issues if you have. - Rahul From Chandigarh to Chennai - find friends all over India. Go to http://in.promos.yahoo.com/groups/citygroups/