kdevplatform/language/duchain
#include <duchainlock.h>
Public Member Functions | |
DUChainLock () | |
~DUChainLock () | |
bool | currentThreadHasReadLock () |
bool | currentThreadHasWriteLock () const |
bool | lockForRead (unsigned int timeout=0) |
bool | lockForWrite (unsigned int timeout=0) |
void | releaseReadLock () |
void | releaseWriteLock () |
Detailed Description
Customized read/write locker for the definition-use chain.
Definition at line 53 of file duchainlock.h.
Constructor & Destructor Documentation
◆ DUChainLock()
KDevelop::DUChainLock::DUChainLock | ( | ) |
Constructor.
Definition at line 69 of file duchainlock.cpp.
◆ ~DUChainLock()
|
default |
Destructor.
Member Function Documentation
◆ currentThreadHasReadLock()
bool KDevelop::DUChainLock::currentThreadHasReadLock | ( | ) |
Determines if the current thread has a read lock.
Definition at line 115 of file duchainlock.cpp.
◆ currentThreadHasWriteLock()
bool KDevelop::DUChainLock::currentThreadHasWriteLock | ( | ) | const |
Determines if the current thread has a write lock.
Definition at line 201 of file duchainlock.cpp.
◆ lockForRead()
bool KDevelop::DUChainLock::lockForRead | ( | unsigned int | timeout = 0 | ) |
Acquires a read lock.
Will not return until the lock is acquired or timeout
Any number of read locks can be acquired at once, but not while there is a write lock. Read locks are recursive. That means that a thread can acquire a read-lock when it already has an arbitrary count of read- and write-locks acquired.
- Parameters
-
timeout A locking timeout in milliseconds. If it is reached, and the lock could not be acquired, false is returned. If null, the default timeout is used.
Step 1: Increase the own reader-recursion. This will make sure no further write-locks will succeed
Step 2: Start spinning until there is no writer any more
Definition at line 76 of file duchainlock.cpp.
◆ lockForWrite()
bool KDevelop::DUChainLock::lockForWrite | ( | unsigned int | timeout = 0 | ) |
Acquires a write lock.
Will not return until the lock is acquired or timeout is reached (10 seconds).
Write locks are recursive. That means that they can by acquired by threads that already have an arbitrary count of write-locks acquired.
- Parameters
-
timeout A timeout in milliseconds. If zero, the default-timeout is used(Currently 10 seconds).
- Warning
- Write-locks can NOT be acquired by threads that already have a read-lock.
Definition at line 122 of file duchainlock.cpp.
◆ releaseReadLock()
void KDevelop::DUChainLock::releaseReadLock | ( | ) |
Releases a previously acquired read lock.
Definition at line 108 of file duchainlock.cpp.
◆ releaseWriteLock()
void KDevelop::DUChainLock::releaseWriteLock | ( | ) |
Releases a previously acquired write lock.
Definition at line 180 of file duchainlock.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Apr 10 2021 23:30:23 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.