Topic Path: Symbol Reference > Classes > TEvent Class > TEvent Methods > WaitFor Method
TEvent.WaitFor Method

Blocks the current thread until the current event receives a signal.

function WaitFor(
    Timeout: LongWord
): TWaitResult; virtual;
Number of milliseconds to wait for a signal on the event handle. 

TWaitResult - Enumerated value representing the method result.

WaitFor is a TWaitResult function used to block execution of the current thread until the current event receives a signal. WaitFor wraps calls to the overloaded WaitHandle.WaitOne methods from the FCL, and provides an enumerated value to represent the result of the operation. 

Timeout indicates the optional number of milliseconds to wait for the signal on the waitable event handle. The value INFINITE indicates that the value in Timeout is not used when calling the overloaded WaitHandle.WaitOne method. 

The return value for the method can contain one of the enumerated values defined in TWaitResult, with the following values and meanings: 


Value Meaning 

--------- ---------------------------------------------------


wrSignaled A signal was received. 
wrTimeout A signal was not received before the optional timeout period elapsed. 
wrAbandoned ??? 
wrError An exception occurred while waiting for the signal. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.