[Overview][Types][Classes][Index] Reference for unit 'LazCollections' (#lazutils)

TLazMonitor

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

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

Declaration

Source position: lazcollections.pas line 42

type TLazMonitor = class(TCriticalSection)

public

  constructor create;

  

Constructor for the class instance.

  procedure Acquire; override;

  

Limits thread access to the calling thread.

  property SpinCount: Integer; [rw]

  

Number of busy waiting iterations used in the monitor.

  property DefaultSpinCount: Integer; [rw]

  

Default number of busy waiting iterations used in instances of the class.

end;

Inheritance

TLazMonitor

  

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

|

TCriticalSection

|

TSynchroObject

|

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

TLazMonitor.Acquire

  

Limits thread access to the calling thread.

TLazMonitor.SpinCount

  

Number of busy waiting iterations used in the monitor.

TLazMonitor.DefaultSpinCount

  

Default number of busy waiting iterations used in instances of the class.

TLazThreadedQueue

  

Implements a thread-safe FIFO queue for items of a generic type.

TCriticalSection


Version 4.0 Generated 2025-05-03 Home