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

# WaitForThreadTerminate

Wait for a thread to terminate.

## Declaration

Source position: threadh.inc line 140

`function WaitForThreadTerminate(`
`threadHandle: TThreadID;`
`TimeoutMs: LongInt`
`):DWord;`

## Description

WaitForThreadTerminate waits for a thread to finish its execution. The thread is identified by it's handle or ID threadHandle. If the thread does not exit within TimeoutMs milliseconds, the function will return with an error value.

The function returns the exit code of the thread.

Not all platforms support the timeout parameter: the unix platforms (with threads support based on pthreads) do not support timeout, and will wait indefinitely for the thread to exit.

## See also

EndThread |  | End the current thread.
KillThread |  | Kill a running thread

Documentation generated on: Feb 26 2014