TThreadLock
Protects a range of code using critical section
Inheritance
Level | Ancestor | Description |
---|---|---|
1 | TObject | Ultimate ancestor in a class hierarchy |
2 | TThreadLock |
Source
Thread.Lock.pas (25)
Description
Only one thread at a time can own the critical section. Please assure that an acquired critical section is always released using the following pattern:
1
2
3
4
5
6
7
Lock.Acquire();
try
// Code protected by the critical section
finally
Lock.Release();
end;
Fields
Scope | Visibility | Type | Name | Description |
---|---|---|---|---|
Instance | protected | TCriticalSection | CriticalSection |
Methods
Scope | Visibility | Result | Name | Description |
---|---|---|---|---|
Instance | public | Create() | ||
Instance | public | Destroy() | ||
Instance | public | Acquire() | ||
Instance | public | Release() | ||
Instance | public | TBoolean | TryAcquire() |