RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TMonitor.TryEnter Method

Attempts to lock the specified object, so that only the calling thread is able to access the object.

Pascal
class function TryEnter(AObject: TObject): Boolean; overload; static;
C++
static __fastcall Boolean TryEnter(TObject * AObject);

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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!