Added a sleep to a tight loop because on some systems CPU usage was at 100%.

git-svn-id: http://yate.null.ro/svn/yate/trunk@2397 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2008-12-05 21:14:11 +00:00
parent da06d2e39f
commit 610f2ed787
2 changed files with 12 additions and 1 deletions

View File

@ -5,6 +5,9 @@
; account: string: The account used to query the database
;account=
; defsleep: int: Loop sleep time in milliseconds
;defsleep=20
; notifyhanguponunload: boolean: Notify hangup for all queued calls when the
; module is unloaded or the program terminates
; Defaults to yes

View File

@ -182,6 +182,7 @@ static NamedList s_resNotifStatus(""); // Events to status resource notify tra
static QueuedCallWorker* s_thread = 0;
static Configuration s_cfg;
static ObjList s_calls; // Queued calls (this list must be locked using the plugin)
static int s_sleepMs = 20; // Loop sleep time
// Event strings associated with queued call status
TokenDict QueuedCall::s_events[] = {
@ -536,8 +537,10 @@ void QueuedCallWorker::run()
}
}
__plugin.unlock();
Thread::yield(true);
Thread::msleep(s_sleepMs,true);
}
else
Thread::yield(true);
// Pick a call to process
processed = false;
__plugin.lock();
@ -726,6 +729,11 @@ void QueuesNotifyModule::initialize()
m_account = general->getValue("account");
s_notifyHangupOnUnload = general->getBoolValue("notifyhanguponunload",true);
s_addNodeToResource = general->getBoolValue("addnodenametoresource",true);
s_sleepMs = general->getIntValue("defsleep",20);
if (s_sleepMs < 5)
s_sleepMs = 5;
if (s_sleepMs > 1000)
s_sleepMs = 1000;
// Events to status translation table
NamedList* status = s_cfg.getSection("events");