• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/language/duchain

  • KDevelop
  • DUChainLock
Public Member Functions | List of all members
KDevelop::DUChainLock Class Reference

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

KDevelop::DUChainLock::~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
timeoutA 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
timeoutA 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:
  • duchainlock.h
  • duchainlock.cpp
This file is part of the KDE documentation.
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.

kdevplatform/language/duchain

Skip menu "kdevplatform/language/duchain"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal