Added separate object counter for worker threads.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5784 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2014-02-24 12:46:39 +00:00
parent 6565a427ff
commit ed9f8d7707
1 changed files with 3 additions and 0 deletions

View File

@ -239,6 +239,7 @@ static SharedVars s_vars;
static Mutex s_hooksMutex(true,"HooksList");
static ObjList s_hooks;
static NamedCounter* s_counter = 0;
static NamedCounter* s_workCnt = 0;
const TokenDict Engine::s_callAccept[] = {
{"accept", Engine::Accept},
@ -836,6 +837,7 @@ bool EngineHelp::received(Message &msg)
void EnginePrivate::run()
{
setCurrentObjCounter(s_workCnt);
for (;;) {
s_makeworker = false;
Engine::self()->m_dispatcher.dequeue();
@ -876,6 +878,7 @@ static int engineRun(EngineLoop loop = 0)
s_startMsg.trimSpaces();
Output("%s",s_startMsg.c_str());
Thread::setCurrentObjCounter((s_counter = GenObject::getObjCounter("engine")));
s_workCnt = GenObject::getObjCounter("workers");
int retcode = Engine::self()->engineInit();
if (!retcode)
retcode = (loop ? loop() : Engine::self()->run());