[Overview][Constants][Types][Classes][Index] | Reference for unit 'syncobjs' (#fcl)

# TCriticalSection.TryEnter

Try and obtain the critical section

## Declaration

Source position: syncobjs.pp line 49

`public function TCriticalSection.TryEnter: Boolean;`

## Function result

False if another thread owns the critical section, true if obtained at once.

## Description

TryEnter tries to enter the critical section: it returns at once and does not wait if the critical section is owned by another thread; if the current thread owns the critical section or the critical section was obtained successfully, true is returned. If the critical section is currently owned by another thread, False is returned.

## Errors

None.

## See also

TCriticalSection.Enter |  | Alias for Acquire