RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TMonitor.Enter Method (TObject, Cardinal)

Prohibits the access of all other threads but the calling one to the specified object.

Pascal
class function Enter(AObject: TObject; Timeout: Cardinal): Boolean; overload; static;
C++
static __fastcall Boolean Enter(TObject * AObject, unsigned Timeout);

Use the Enter method to prohibit AObject from being accessed by threads, other than the calling one.  

Before attempting to lock the specified object, Enter tests whether the thread that is currently locking the object, if any, has made an equal number of calls to Enter and to Exit. If not, the calling thread is blocked from accessing the object until the previous thread releases it.  

The Enter function attempts to lock the specified object for the amount of time designated by the Timeout parameter. If the lock attempt is successful, Enter returns True, otherwise it returns False. 

 

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