System.TMonitor.TryEnter
Delphi
class function TryEnter(const AObject: TObject): Boolean; overload; static;
C++
static bool __fastcall TryEnter(TObject* const AObject)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.pas System.hpp |
System | TMonitor |
Description
Attempts to lock the specified object, so that only the calling thread is able to access the object.
The TryEnter function attempts to lock the object given as parameter, so that only the calling thread can access the object.
TryEnter returns True if it manages to lock the object, or False otherwise.
As opposed to the Enter method, TryEnter does not block the calling thread if the given object is currently owned by other threads.