Slow down the consumer waiting loop as to not burn too much CPU.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6064 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
8526e7f01f
commit
03752b3f44
|
@ -362,11 +362,19 @@ void WaveSource::run()
|
|||
// internally reference if used for override or replace purpose
|
||||
bool noChan = (0 == m_chan);
|
||||
// wait until at least one consumer is attached
|
||||
unsigned int fast = 4;
|
||||
while (!r) {
|
||||
lock();
|
||||
r = m_consumers.count();
|
||||
unlock();
|
||||
Thread::yield();
|
||||
if (r)
|
||||
;
|
||||
else if (fast) {
|
||||
--fast;
|
||||
Thread::yield();
|
||||
}
|
||||
else
|
||||
Thread::idle();
|
||||
if (!looping(noChan)) {
|
||||
notify(0,"replaced");
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue