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

# TEventObject.WaitFor

Wait for the event to be set.

## Declaration

Source position: syncobjs.pp line 74

`public function TEventObject.WaitFor(`
`Timeout: Cardinal`
`):TWaitResult;`

## Arguments

`Timeout` |  | Maximum time to wait for the event to be set

## Function result

Reason for returning

## Description

WaitFor should be used in threads that should be notified when the event is set. When WaitFor is called, and the event is not set, the thread will be suspended. As soon as the event is set by some other thread (using SetEvent) or the timeout period (TimeOut) has expired, the WaitFor function returns. The return value depends on the condition that caused the WaitFor function to return.

The calling thread will wait indefinitely when the constant INFINITE is specified for the TimeOut parameter.

## See also

TEventObject.SetEvent |  | Set the event