[Overview][Types][Classes][Index] |
Limits thread access to the calling thread.
Source position: lazcollections.pas line 52
public procedure TLazMonitor.Acquire; override; |
Acquire is an overridden procedure used to limit threaded access to resources to the current calling thread. Acquire extends the inherited method to use a spinlock (or busy waiting loop) to get mutually exclusive access to resources shared between threads.
The SpinLock processing loop waits for successful completion of the Enter/Acquire method, but yields CPU cycles by calling sleep() to allow other threads to execute periodically. The internal yield/sleep thresholds are artificially low (10ms - 20ms) to avoid process scheduler/context switching conflicts for executing threads.
The inherited Acquire method is called when the method has successfully blocked access to other threads by entering the critical section.
Use the SpinCount property to determine the maximum number of iterations for the spinlock processing cycle. Use DefaultSpinCount to determine the default value used for the SpinCount property in new instances of the class.
|
Number of busy waiting iterations used in the monitor. |
|
|
Default number of busy waiting iterations used in instances of the class. |
|
Version 4.0 | Generated 2025-05-03 | Home |