Skip to content
GR32>TThreadPersistentClass

TThreadPersistent

Ancestor for TBitmap32 and core graphics objects, adding thread-safe locking mechanisms in addition to change notifications.

Inheritance:TObject > TPersistent > TPlainInterfacedPersistent > TNotifiablePersistent > TThreadPersistent

Declaration

pascal
TThreadPersistent = class(TNotifiablePersistent)

Description ​

TThreadPersistent extends TNotifiablePersistent by providing critical-section locking methods (Lock and Unlock). This ensures thread-safe access to graphics surfaces and data structures across concurrent threads.

WARNING

Inheriting from TThreadPersistent does not automatically make an object thread safe. TThreadPersistent merely provides a locking mechanism that you can employ to make your code thread safe.

Likewise, even though many Graphics32 classes inherit from TThreadPersistent, use of these classes are not inherently thread safe.

Constructors ​

NameDescription
CreateInitializes a new instance of TThreadPersistent and creates its internal critical section.

Methods ​

NameDescription
LockAcquires the internal critical section lock.
UnlockReleases the internal critical section lock.

Properties ​

NameTypeScopeDescription
LockCountIntegerProtectedReturns the current recursion level of critical section locks.