THREAD SUSPEND statement

Purpose

Suspend execution of a Windows thread.

Syntax

THREAD SUSPEND hThread TO lResult&

Remarks

THREAD SUSPEND adds 1 to the suspend count of the thread specified by hThread (see THREAD  CREATE).  If it succeeds, the lResult& value is the thread's previous suspend count; otherwise, it is -1.  A thread is always suspended if it has a suspend count of 1 or higher.

To decrement the suspend count of a thread, use the THREAD RESUME statement.  A suspended thread will only resume execution when its suspend count is decremented to 0.

Restrictions

The THREAD SUSPEND statement generates no run-time errors; all exceptions are reported in the return value lResult&.  A thread ID cannot be used interchangeably with a thread handle.  A thread can suspend itself by incrementing its own suspend count.

See also

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