Sign in Join
FPDoc Onlineexperiment

TLazMonitor class

In unit LazCollections

Implements a synchronization construct which provides thread-safe access to resources.

Declaration

pascal
TLazMonitor = class(TCriticalSection)

Inheritance

  1. TLazMonitor
  2. TCriticalSection
  3. TSynchroObject
  4. TObject

Description

TLazMonitor is a TCriticalSection descendant which implements a synchronization construct that provides thread-safe access to resources. TLazMonitor extends the ancestor class to use a fixed number of spinlock (or busy waiting) attempts in its Acquire method. Acquire also yields CPU cycles to allow other threads to execute when fixed yield and/or sleep threshold(s) have been reached.

TLazMonitor is used in the implementation of the TLazThreadedQueue class, and in the fppkg package.

See also

Properties

SpinCountpublicNumber of busy waiting iterations used in the monitor.
DefaultSpinCountpublicDefault number of busy waiting iterations used in instances of the class.

Methods

createpublicConstructor for the class instance.
AcquirepublicLimits thread access to the calling thread.

Inherited

From TCriticalSection (6)

Destroy Enter Leave Release TryEnter WaitFor

From TObject (40)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.