mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-06 13:18:27 +02:00
timerd: prevent events from being deleted while sending them to neutrino
in neutrino's timer list sometimes appears an entry with random values
after deleting one because thread safety is not guaranteed for timerd's
event list while sending items to neutrino, so let's lock the mutex
earlier and unlock it later
Signed-off-by: Christian Schuett <Gaucho316@hotmail.com>
Signed-off-by: Thilo Graf <dbt@novatux.de>
Origin commit data
------------------
Commit: a96fb7b7f0
Author: Gaucho316 <Gaucho316@hotmail.com>
Date: 2014-02-14 (Fri, 14 Feb 2014)
This commit is contained in:
committed by
Jacek Jendrzej
parent
88c27e6c96
commit
a21a12ebee
@@ -277,12 +277,24 @@ bool CTimerManager::stopEvent(int peventID)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
int CTimerManager::lockEvents()
|
||||
{
|
||||
return pthread_mutex_lock(&tm_eventsMutex);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
int CTimerManager::unlockEvents()
|
||||
{
|
||||
return pthread_mutex_unlock(&tm_eventsMutex);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
bool CTimerManager::listEvents(CTimerEventMap &Events)
|
||||
{
|
||||
if(!&Events)
|
||||
return false;
|
||||
|
||||
pthread_mutex_lock(&tm_eventsMutex);
|
||||
|
||||
Events.clear();
|
||||
for (CTimerEventMap::iterator pos = events.begin(); pos != events.end(); ++pos)
|
||||
@@ -290,7 +302,6 @@ bool CTimerManager::listEvents(CTimerEventMap &Events)
|
||||
pos->second->Refresh();
|
||||
Events[pos->second->eventID] = pos->second;
|
||||
}
|
||||
pthread_mutex_unlock(&tm_eventsMutex);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user