[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'InterfaceBase' (#lcl)

# TWidgetSet.InitializeCriticalSection

Initializes a Critical Section object.

## Declaration

Source position: winapih.inc line 171

`public procedure TWidgetSet.InitializeCriticalSection(`
`var CritSection: TCriticalSection`
`); virtual;`

## Arguments

`CritSection` |  | The critical section object.

## Description

Critical sections are thread synchronization elements, typically used to prevent concurrent access to a shared resource.

Only one thread can own a critical section at the same time, other requests (to enter the same critical section) are delayed until the owner has left the critical section.

The TCriticalSection type is platform specific. It is treated like a Handle.

## See also

TWidgetSet.EnterCriticalSection |  | Enters a critical section.
TWidgetSet.LeaveCriticalSection |  | Releases a critical section, and allows use by other threads.
TWidgetSet.DeleteCriticalSection |  | Deletes an un-owned critical section.