System.MonitorTryEnter

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function MonitorTryEnter(const AObject: TObject): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall MonitorTryEnter(TObject* const AObject);

Properties

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

Description

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

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.

See Also