mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
ComponentsTimer: ensure slot connect/disconnect dependency from slot state
Origin commit data
------------------
Commit: f4eb9e45ec
Author: Thilo Graf <dbt@novatux.de>
Date: 2016-04-17 (Sun, 17 Apr 2016)
This commit is contained in:
@@ -83,8 +83,10 @@ bool CComponentsTimer::startTimer()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (res == 0){
|
if (res == 0){
|
||||||
dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s - %d] timer thread [%lu] created with interval = %d\033[0m\n", __func__, __LINE__, pthread_self(), tm_interval);
|
if (!sl.empty()){
|
||||||
CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl);
|
dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s - %d] timer thread [%lu] created with interval = %d\033[0m\n", __func__, __LINE__, pthread_self(), tm_interval);
|
||||||
|
CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_create\033[0m\n", __func__, __LINE__);
|
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_create\033[0m\n", __func__, __LINE__);
|
||||||
}
|
}
|
||||||
@@ -107,9 +109,12 @@ bool CComponentsTimer::stopTimer()
|
|||||||
|
|
||||||
if (thres == 0){
|
if (thres == 0){
|
||||||
tm_thread = 0;
|
tm_thread = 0;
|
||||||
|
dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s] timer thread terminated ...\033[0m\n", __func__);
|
||||||
//ensure disconnect of unused slot
|
//ensure disconnect of unused slot
|
||||||
sl.disconnect();
|
if (!sl.empty()){
|
||||||
dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer] [%s] timer thread terminated ...\033[0m\n", __func__);
|
dprintf(DEBUG_INFO,"\033[33m[CComponentsTimer][%s] disconnect timer slot ...\033[0m\n", __func__);
|
||||||
|
sl.disconnect();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user