Show: Delphi C++
Display Preferences

System.MonitorEnter

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function MonitorEnter(const AObject: TObject; Timeout: Cardinal = INFINITE): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall MonitorEnter(TObject* const AObject, unsigned Timeout = (unsigned)(0xffffffff));

Properties

Type Visibility Source Unit Parent
function public
System.pas
System.hpp
System System

Description

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

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

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

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

See Also

Personal tools
RAD Studio 10.2 Tokyo
In Other Languages
Previous Versions
Assistance