System.SyncObjs.TSpinLock.TryEnter

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function TryEnter: Boolean; overload; inline;
function TryEnter(Timeout: Cardinal): Boolean; overload;
function TryEnter(const Timeout: TTimeSpan): Boolean; overload;

C++

bool __fastcall TryEnter()/* overload */;
bool __fastcall TryEnter(unsigned Timeout)/* overload */;
bool __fastcall TryEnter(const System::Timespan::TTimeSpan &Timeout)/* overload */;

Properties

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

Description

Tries to enter the spin lock.

TSpinLock has three TryEnter overloads.

Call one TryEnter method to attempt acquiring the spin lock. The calling thread will wait in a loop repeatedly checking until the lock becomes available. TryEnter returns True if the lock is entered, False otherwise.

The first TryEnter method calls the second TryEnter method providing 0 value as a parameter.

The second TryEnter method receives Timeout of type Longword as parameter. Timeout specifies the time the lock waits to be released.

The third TryEnter method is similar to the second one. Timeout is, in this case, of type TTimeSpan.

See Also