vdr 2.6.1
Public Member Functions | Private Attributes | Friends | List of all members
cStateKey Class Reference

#include <thread.h>

Public Member Functions

 cStateKey (bool IgnoreFirst=false)
 
 ~cStateKey ()
 
void Reset (void)
 
void Remove (bool IncState=true)
 
bool StateChanged (void)
 
bool InLock (void)
 
bool TimedOut (void) const
 
 cStateKey (bool IgnoreFirst=false)
 
 ~cStateKey ()
 
void Reset (void)
 
void Remove (bool IncState=true)
 
bool StateChanged (void)
 
bool InLock (void)
 
bool TimedOut (void) const
 

Private Attributes

cStateLock * stateLock
 
bool write
 
int state
 
bool timedOut
 

Friends

class cStateLock
 

Detailed Description

Definition at line 233 of file include/vdr/thread.h.

Constructor & Destructor Documentation

◆ cStateKey() [1/2]

cStateKey::cStateKey ( bool  IgnoreFirst = false)

Sets up a new state key.

If IgnoreFirst is true, the first use of this key with a lock will not return true if the lock's state hasn't explicitly changed.

Definition at line 837 of file thread.c.

References Reset(), state, stateLock, and write.

◆ ~cStateKey() [1/2]

cStateKey::~cStateKey ( )

Definition at line 846 of file thread.c.

References ABORT, esyslog, cStateLock::name, stateLock, and cStateLock::threadId.

◆ cStateKey() [2/2]

cStateKey::cStateKey ( bool  IgnoreFirst = false)

Sets up a new state key.

If IgnoreFirst is true, the first use of this key with a lock will not return true if the lock's state hasn't explicitly changed.

◆ ~cStateKey() [2/2]

cStateKey::~cStateKey ( )

Member Function Documentation

◆ InLock() [1/2]

bool cStateKey::InLock ( void  )
inline

Returns true if this key is currently in a lock.

Definition at line 260 of file include/vdr/thread.h.

References stateLock.

◆ InLock() [2/2]

bool cStateKey::InLock ( void  )
inline

Returns true if this key is currently in a lock.

Definition at line 260 of file thread.h.

References stateLock.

◆ Remove() [1/2]

void cStateKey::Remove ( bool  IncState = true)

◆ Remove() [2/2]

void cStateKey::Remove ( bool  IncState = true)

Removes this key from the lock it was previously used with.

If this key was used to obtain a write lock, the state of the lock will be incremented and copied to this key. You can set IncState to false to prevent this.

◆ Reset() [1/2]

void cStateKey::Reset ( void  )

Resets the state of this key, so that the next call to a lock's Lock() function with this key will return true, even if the lock's state hasn't changed.

Definition at line 854 of file thread.c.

References state.

Referenced by cStateKey(), cMenuChannels::Delete(), main(), cMenuChannels::Set(), cMenuSchedule::Set(), cSkinLCARSDisplayMenu::SetMenuCategory(), and cMenuRecordings::Sort().

◆ Reset() [2/2]

void cStateKey::Reset ( void  )

Resets the state of this key, so that the next call to a lock's Lock() function with this key will return true, even if the lock's state hasn't changed.

◆ StateChanged() [1/2]

bool cStateKey::StateChanged ( void  )

Returns true if this key is used for obtaining a write lock, and the lock's state differs from that of the key.

When used with a read lock, it always returns true, because otherwise the lock wouldn't have been obtained in the first place.

Definition at line 869 of file thread.c.

References ABORT, esyslog, cStateLock::state, state, stateLock, cThread::ThreadId(), and write.

Referenced by main().

◆ StateChanged() [2/2]

bool cStateKey::StateChanged ( void  )

Returns true if this key is used for obtaining a write lock, and the lock's state differs from that of the key.

When used with a read lock, it always returns true, because otherwise the lock wouldn't have been obtained in the first place.

◆ TimedOut() [1/2]

bool cStateKey::TimedOut ( void  ) const
inline

Returns true if the last lock attempt this key was used with failed due to a timeout.

Definition at line 262 of file include/vdr/thread.h.

References timedOut.

Referenced by cSVDRPClientHandler::ProcessConnections().

◆ TimedOut() [2/2]

bool cStateKey::TimedOut ( void  ) const
inline

Returns true if the last lock attempt this key was used with failed due to a timeout.

Definition at line 262 of file thread.h.

References timedOut.

Friends And Related Function Documentation

◆ cStateLock

cStateLock
friend

Definition at line 234 of file include/vdr/thread.h.

Member Data Documentation

◆ state

int cStateKey::state
private

◆ stateLock

cStateLock * cStateKey::stateLock
private

◆ timedOut

bool cStateKey::timedOut
private

Definition at line 239 of file include/vdr/thread.h.

Referenced by cStateLock::Lock(), and TimedOut().

◆ write

bool cStateKey::write
private

The documentation for this class was generated from the following files: