From 7619ed259180e2791a690790f4a6578ddaae5e5d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 10 Apr 2011 18:20:02 +0000 Subject: [PATCH] better solution for Mutex problem --- src/serverlist.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index d096ee58..a3f4c4ce 100755 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -97,17 +97,20 @@ void CServerListManager::SetEnabled ( const bool bState ) } else { + // initiate registration right away so that we do not have to wait + // for the first time out of the timer until the slave server gets + // registered at the central server, note that we have to unlock + // the mutex before calling the function since inside this function + // the mutex is locked, too + locker.unlock(); + { + OnTimerRegistering(); + } + locker.relock(); + // start timer for registering this server at the central server // 1 minute = 60 * 1000 ms TimerRegistering.start ( SERVLIST_REGIST_INTERV_MINUTES * 60000 ); - - -// TODO initiate a registration right away so we do not have to wait for the -// first time out of the timer -// TEST we cannot call RegisterServer directly since we would get a mutex dead lock -QTimer::singleShot(1, this, SLOT ( OnTimerRegistering() ) ); - - } } else