Actually - I just tried to rtfm to find the relevant part, and it is
less than obvious given the rather terse description of xtime as a time
or a duration. I don't think anything in boost.threads uses xtime as a
duration (any more - since about 2001)?
________________________________
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Darryl Green
Sent: Wednesday, 11 October 2006 4:48 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [thread] bug: thread::sleep can't
'Idle'
Hi Daniel,
boost::thread:sleep takes a time, not a duration. For details,
rationale etc rtfm.
________________________________
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Daniel Winsor
Sent: Wednesday, 11 October 2006 4:40 PM
To: boost-users@lists.boost.org
Subject: [Boost-users] [thread] bug: thread::sleep can't
'Idle'
#include
#include
#include //for sleep
void
ExecuteThread()
{
for(;;) {
boost::xtime time;
time.nsec = 0;
time.sec = 1;
boost::thread::sleep(time);
//Sleep(1000);
}
}
int
main()
{
boost::thread thread1(ExecuteThread);
boost::thread thread2(ExecuteThread);
thread1.join();
thread2.join();
return 0;
}
When this program is run with Sleep() instead of
boost::thread::sleep(), and there are no other cpu intensive programs
running, Task Manager shows 99% of the cpu (dual core) is idle.
However, when it is run with boost::thread::sleep(), 99% of the cpu is
being used by the program! This is a problem because powersaving
features no longer work.
When this program with boost::thread::sleep() is run
with another program that is cpu intensive, Task Manager reports the
other program uses 99% of the cpu, so there is no problem there.
I am using an overclocked Intel Core 2 Duo 6400 if that
matters.
________________________________
This e-mail is for the use of the intended recipient(s) only.
If you have received this e-mail in error, please notify the sender
immediately and then delete it. If you are not the intended recipient,
you must not use, disclose or distribute this e-mail without the
author's prior permission. We have taken precautions to minimise the
risk of transmitting software viruses, but we advise you to carry out
your own virus checks on any attachment to this message. We cannot
accept liability for any loss or damage caused by software viruses.
________________________________
##########################################################################
This e-mail is for the use of the intended recipient(s) only. If you have
received this e-mail in error, please notify the sender immediately and
then delete it. If you are not the intended recipient, you must not use,
disclose or distribute this e-mail without the author's prior permission.
We have taken precautions to minimise the risk of transmitting software
viruses, but we advise you to carry out your own virus checks on any
attachment to this message. We cannot accept liability for any loss or
damage caused by software viruses.
##########################################################################