vdr 2.7.6
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

Private Attributes

cStateLockstateLock
bool write
int state
bool timedOut

Friends

class cStateLock

Detailed Description

Definition at line 233 of file thread.h.

Constructor & Destructor Documentation

◆ cStateKey()

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 847 of file thread.c.

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

◆ ~cStateKey()

cStateKey::~cStateKey ( )

Definition at line 856 of file thread.c.

References ABORT, esyslog, and stateLock.

Member Function Documentation

◆ InLock()

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()

void cStateKey::Remove ( bool IncState = true)

◆ Reset()

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 864 of file thread.c.

References state.

Referenced by cStateKey(), and main().

◆ StateChanged()

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 879 of file thread.c.

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

Referenced by main().

◆ TimedOut()

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.

◆ cStateLock

friend class cStateLock
friend

Definition at line 234 of file thread.h.

References cStateLock.

Referenced by cStateLock.

Member Data Documentation

◆ state

int cStateKey::state
private

Definition at line 238 of file thread.h.

Referenced by cStateKey(), cStateLock::Lock(), Reset(), StateChanged(), and cStateLock::Unlock().

◆ stateLock

cStateLock* cStateKey::stateLock
private

◆ timedOut

bool cStateKey::timedOut
private

Definition at line 239 of file thread.h.

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

◆ write

bool cStateKey::write
private

Definition at line 237 of file thread.h.

Referenced by cStateKey(), cStateLock::Lock(), StateChanged(), and cStateLock::Unlock().


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