
8 Mar
2002
8 Mar
'02
3:39 a.m.
On Thu, 2002-03-07 at 17:01, simonwlb wrote:
I'm using thread::yield() in my multi-threaded cross-platform application to avoid "CPU burn". <snip> { if( m_x->isReady() ) doSomething(); <..>
If the answer is "you should almost never poll like that - try to use mutexes etc. as much as possible" please say so (I'm a newbie to threads)!
The answer is actually probably conditionals plus mutexes. Presumably one thread is doing something, and other threads are waiting for it to be ready. This is a standard producer/consumer model.
{ boost: