THREAD STATUS statement

Purpose

Retrieve the Status of a Windows thread.

Syntax

THREAD STATUS hThread TO lResult&

Remarks

THREAD STATUS assigns the status of the thread identified by the DWORD value in hThread (see THREAD  CREATE) to lResult&.

If the function fails, lResult& is set to zero.  If the thread is still running, the system value &H103 is assigned.  If the thread has terminated and the thread handle has not yet been closed, the return value from the thread Function is assigned to lResult&.  To wait for one or more threads to complete execution, use the WaitForSingleObject or WaitForMultipleObjects API functions - see THREAD CLOSE for more information.

The number of currently running threads in a module can be determined with the THREADCOUNT function.

Restrictions

The THREAD STATUS statement generates no run-time errors; all exceptions are reported in the return value lResult&.  A thread ID cannot be used in place of a thread handle.

See also

FUNCTION/END FUNCTION, THREAD CLOSE, THREAD CREATE, THREAD RESUME, THREAD SUSPEND, THREADCOUNT, THREADED variables, THREADID