RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.MonitorTryEnter Function

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

Pascal
function MonitorTryEnter(AObject: TObject): Boolean;
C++
Boolean MonitorTryEnter(TObject * AObject);

The MonitorTryEnter function attempts to lock the object given as parameter, so that only the calling thread can access it.  

MonitorTryEnter returns True if it manages to lock the object, or False otherwise.  

As opposed to the MonitorEnter method, MonitorTryEnter 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!