vdr
2.4.7
|
#include <tools.h>
Public Member Functions | |
virtual | ~cListBase () |
bool | Lock (cStateKey &StateKey, bool Write=false, int TimeoutMs=0) const |
void | SetSyncStateKey (cStateKey &StateKey) |
void | SetUseGarbageCollector (void) |
void | SetExplicitModify (void) |
void | SetModified (void) |
void | Add (cListObject *Object, cListObject *After=NULL) |
void | Ins (cListObject *Object, cListObject *Before=NULL) |
void | Del (cListObject *Object, bool DeleteObject=true) |
virtual void | Move (int From, int To) |
void | Move (cListObject *From, cListObject *To) |
virtual void | Clear (void) |
bool | Contains (const cListObject *Object) const |
const cListObject * | Get (int Index) const |
cListObject * | Get (int Index) |
int | Count (void) const |
void | Sort (void) |
Protected Member Functions | |
cListBase (const char *NeedsLocking=NULL) | |
Protected Attributes | |
cListObject * | objects |
cListObject * | lastObject |
int | count |
cStateLock | stateLock |
const char * | needsLocking |
bool | useGarbageCollector |
|
protected |
Definition at line 2135 of file tools.c.
References count, lastObject, needsLocking, objects, and useGarbageCollector.
void cListBase::Add | ( | cListObject * | Object, |
cListObject * | After = NULL |
||
) |
Definition at line 2158 of file tools.c.
References cListObject::Append(), count, cListObject::Insert(), lastObject, cListObject::Next(), and objects.
Referenced by cHashBase::Add(), cSectionHandler::Add(), cOsdMenu::Add(), cRecordings::Add(), cTimers::Add(), cMarks::Add(), cRecordingsHandler::Add(), cFilter::Add(), cCaDescriptors::AddCaDescriptor(), cCaDescriptorHandler::AddCaDescriptors(), cChannelCamRelations::AddEntry(), cSchedule::AddEvent(), cCamSlot::AddPid(), cPluginManager::AddPlugin(), cDvbSubtitlePage::AddRegionRef(), cSchedules::AddSchedule(), cNestedItem::AddSubItem(), cTransponderList::AddTransponder(), cScanList::AddTransponder(), cSectionHandler::Attach(), cAudio::cAudio(), cCamSlot::cCamSlot(), cDeviceHook::cDeviceHook(), cEIT::cEIT(), cEpgHandler::cEpgHandler(), cMenuEditFolder::Confirm(), cRemote::cRemote(), cSkin::cSkin(), cSourceParam::cSourceParam(), cStatus::cStatus(), cChannels::DeleteDuplicateChannels(), cDvbSubtitleConverter::FinishPage(), cDvbSubtitlePage::GetClutById(), cSubtitleObjects::GetObjectById(), cDvbSubtitleConverter::GetPageById(), cDvbSubtitlePage::GetRegionById(), cFreetypeFont::Glyph(), cConfig< T >::Load(), cPictureEntry::Load(), cChannels::NewChannel(), cSubtitleRegion::Parse(), cDvbSubtitlePage::Parse(), cSubtitleRegion::ParsePgs(), cPatFilter::Process(), cSdtFilter::Process(), cMenuEditChannel::ProcessKey(), cKeys::PutSetup(), cInterface::QueryKeys(), cCiResourceHandlers::Register(), Sort(), and cSetup::Store().
|
virtual |
Reimplemented in cSkins, cOsdMenu, cNestedItemList, cConfig< T >, cConfig< cSource >, cConfig< cKeyMacro >, cConfig< cSetupLine >, cConfig< cScr >, cConfig< cSVDRPhost >, cConfig< cCamResponse >, cConfig< cChannel >, cConfig< cKey >, cConfig< cTimer >, cConfig< cMark >, and cConfig< cDiseqc >.
Definition at line 2235 of file tools.c.
References count, lastObject, cListObject::Next(), and objects.
Referenced by cVideoDirectoryScannerThread::Action(), cConfig< T >::Clear(), cNestedItemList::Clear(), cOsdMenu::Clear(), cSkins::Clear(), cNestedItemList::Load(), main(), cDvbSubtitlePage::Parse(), cDvbSubtitlePage::ParsePgs(), cPatFilter::Process(), cDvbSubtitleConverter::Reset(), cDevice::Shutdown(), cCamSlot::StopDecrypting(), and ~cListBase().
bool cListBase::Contains | ( | const cListObject * | Object | ) | const |
If a pointer to an object contained in this list has been obtained while holding a lock, and that lock has been released, but the pointer is kept for later use (after obtaining a new lock), Contains() can be called with that pointer to make sure the object it points to is still part of this list (it may have been deleted or otherwise removed from the list after the lock during which the pointer was initially retrieved has been released).
Definition at line 2246 of file tools.c.
References cListObject::Next(), and objects.
Referenced by cMenuChannels::Delete().
|
inline |
Definition at line 594 of file tools.h.
Referenced by cDvbSubtitleConverter::Action(), cVideoDirectoryScannerThread::Action(), cSectionHandler::Action(), cCamSlot::BuildCaPmts(), cCuttingThread::cCuttingThread(), cSVDRPServer::CmdEDIT(), cMenuSetupOSD::cMenuSetupOSD(), cMenuRecordings::Commands(), cOsdMenu::CursorDown(), cOsdMenu::CursorUp(), CutRecording(), cOsdMenu::Del(), cMenuChannels::Delete(), cMenuRecordings::Delete(), cChannel::DelLinkChannel(), cOsdMenu::Display(), cMenuChannels::Edit(), cMenuTimers::Edit(), cReplayControl::EditCut(), cCaDescriptors::Empty(), cRecordingsHandler::Finished(), cDvbSubtitlePage::GetAreas(), cDevice::GetDevice(), cPluginManager::HasPlugins(), cPluginManager::Housekeeping(), cMenuTimers::Info(), cMenuRecordings::Info(), cCamSlot::IsDecrypting(), cOsdMenu::Mark(), cReplayControl::MarkJump(), cOsdMenu::PageDown(), cOsdMenu::PageUp(), cCamSlot::Process(), cPatFilter::Process(), cMenuWhatsOn::ProcessKey(), cMenuSchedule::ProcessKey(), cMenuRecordings::ProcessKey(), cCuttingThread::ProcessSequence(), cChannels::ReNumber(), cMenuRecordings::Rewind(), cVideoDirectoryScannerThread::ScanVideoDir(), cPictureMenu::Set(), cMenuFolderItem::Set(), cMenuCam::Set(), cMenuMain::Set(), cMenuRecordings::SetHelpKeys(), cChannel::SetLinkChannels(), Sort(), and cCamSlot::StopDecrypting().
void cListBase::Del | ( | cListObject * | Object, |
bool | DeleteObject = true |
||
) |
Definition at line 2190 of file tools.c.
References count, lastObject, ListGarbageCollector, cListObject::Next(), objects, cListObject::Prev(), cListGarbageCollector::Put(), cListObject::Unlink(), and useGarbageCollector.
Referenced by cDvbSubtitleConverter::Action(), cRecordingsHandler::Action(), cCaDescriptorHandler::AddCaDescriptors(), cHdffSetupPage::BuildVideoConversionItem(), cChannelCamRelations::Cleanup(), cReplayControl::ClearEditingMarks(), cChannels::Del(), cHashBase::Del(), cSectionHandler::Del(), cTimers::Del(), cOsdMenu::Del(), cFilter::Del(), cRecordings::DelByName(), cMenuFolder::Delete(), cSchedule::DelEvent(), cChannel::DelLinkChannel(), cSectionHandler::Detach(), cReplayControl::MarkToggle(), cEITScanner::Process(), cInterface::QueryKeys(), cVideoDirectoryScannerThread::ScanVideoDir(), cFilter::SetStatus(), cPluginManager::Shutdown(), cSetup::Store(), cCamSlot::~cCamSlot(), cEpgHandler::~cEpgHandler(), cRemote::~cRemote(), and cStatus::~cStatus().
|
inline |
const cListObject * cListBase::Get | ( | int | Index | ) | const |
Definition at line 2265 of file tools.c.
References cListObject::Next(), and objects.
Referenced by cList< T >::Get(), and Move().
void cListBase::Ins | ( | cListObject * | Object, |
cListObject * | Before = NULL |
||
) |
Definition at line 2174 of file tools.c.
References cListObject::Append(), count, cListObject::Insert(), lastObject, objects, and cListObject::Prev().
Referenced by cOsdMenu::Ins(), and cTimers::Ins().
bool cListBase::Lock | ( | cStateKey & | StateKey, |
bool | Write = false , |
||
int | TimeoutMs = 0 |
||
) | const |
Tries to get a lock on this list and returns true if successful.
By default a read lock is requested. Set Write to true to obtain a write lock. If TimeoutMs is not zero, it waits for the given number of milliseconds before giving up. If you need to lock more than one list at the same time, make sure you set TimeoutMs to a suitable value in all of the calls to Lock(), and be prepared to handle situations where you do not get all of the requested locks. In such cases you should release all the locks you have obtained so far and try again. StateKey.TimedOut() tells you whether the lock attempt failed due to a timeout or because the state of the lock hasn't changed since the previous locking attempt. To implicitly avoid deadlocks when locking more than one of the global lists of VDR at the same time, make sure you always lock Timers, Channels, Recordings and Schedules in this sequence. You may keep pointers to objects in this list, even after releasing the lock. However, you may only access such objects if you are holding a proper lock again. If an object has been deleted from the list while you did not hold a lock (for instance by an other thread), the object will still be there, but no longer within this list (it is then stored in the ListGarbageCollector). That way even if you access the object after it has been deleted, you won't cause a segfault. You can call the Contains() function to check whether an object you are holding a pointer to is still in the list. Note that the garbage collector is purged when the usual housekeeping is done.
Definition at line 2149 of file tools.c.
References esyslog, cStateLock::Lock(), needsLocking, and stateLock.
Referenced by cDvbPlayer::Action(), cVideoDirectoryScannerThread::Action(), cReplayControl::ClearEditingMarks(), cChannels::GetChannelsRead(), cChannels::GetChannelsWrite(), cRecordings::GetDeletedRecordingsRead(), cRecordings::GetDeletedRecordingsWrite(), cRecordings::GetRecordingsRead(), cRecordings::GetRecordingsWrite(), cSchedules::GetSchedulesRead(), cSchedules::GetSchedulesWrite(), cTimers::GetTimersRead(), cTimers::GetTimersWrite(), cReplayControl::MarkToggle(), cDvbPlayer::Save(), and cVideoDirectoryScannerThread::ScanVideoDir().
void cListBase::Move | ( | cListObject * | From, |
cListObject * | To | ||
) |
Definition at line 2211 of file tools.c.
References cListObject::Append(), cListObject::Index(), lastObject, cListObject::Next(), objects, cListObject::Prev(), and cListObject::Unlink().
|
virtual |
Reimplemented in cMenuChannels.
Definition at line 2206 of file tools.c.
References Get().
Referenced by cMenuChannels::Move(), and cOsdMenu::ProcessKey().
void cListBase::SetExplicitModify | ( | void | ) |
If you have obtained a write lock on this list, and you don't want it to be automatically marked as modified when the lock is released, a call to this function will disable this, and you can explicitly call SetModified() to have the list marked as modified.
Definition at line 2255 of file tools.c.
References cStateLock::SetExplicitModify(), and stateLock.
Referenced by cMenuRecordings::Delete().
void cListBase::SetModified | ( | void | ) |
Unconditionally marks this list as modified.
Definition at line 2260 of file tools.c.
References cStateLock::SetModified(), and stateLock.
Referenced by cRecordingsHandlerEntry::Active(), cRecordControl::cRecordControl(), and cMenuRecordings::Delete().
|
inline |
When making changes to this list (while holding a write lock) that shall not affect some other code that reacts to such changes, this function can be called with the StateKey used by that other code.
See cStateLock::SetSyncStateKey() for details.
Definition at line 566 of file tools.h.
References cStateLock::SetSyncStateKey().
Referenced by cMenuTimers::Delete(), main(), and cMenuTimers::OnOff().
|
inline |
Definition at line 571 of file tools.h.
Referenced by cSchedule::cSchedule().
void cListBase::Sort | ( | void | ) |
Definition at line 2282 of file tools.c.
References Add(), CompareListObjects(), count, Count(), lastObject, MALLOC, cListObject::Next(), objects, and cListObject::Unlink().
Referenced by cScanList::AddTransponders(), cChannels::DeleteDuplicateChannels(), cPictureEntry::Load(), cMenuTimers::ProcessKey(), cSetup::Save(), cMenuChannels::Set(), cMenuRecordings::Set(), cMenuFolder::Set(), cMenuSchedule::Set(), cMenuTimers::Set(), and cSchedule::Sort().
|
protected |
Definition at line 534 of file tools.h.
Referenced by Add(), Clear(), cListBase(), Del(), cOsdMenu::Del(), cOsdMenu::Display(), Ins(), and Sort().
|
protected |
|
protected |
Definition at line 536 of file tools.h.
Referenced by cListBase(), and Lock().
|
protected |
|
mutableprotected |
Definition at line 535 of file tools.h.
Referenced by Lock(), SetExplicitModify(), and SetModified().
|
protected |
Definition at line 537 of file tools.h.
Referenced by cListBase(), and Del().