THREAD RESUME statement

Purpose

Resume execution of a Windows thread.

Syntax

THREAD RESUME hThread TO lResult&

Remarks

THREAD RESUME decreases the suspend count of the thread identified by the 32-bit DWORD value stored in hThread (see THREAD  CREATE).  If it succeeds, the lResult& value is the thread's previous suspend count; otherwise, it is -1.

Execution of a suspended thread resumes when the suspend count of a thread is decremented to zero.  If the SUSPEND option is included in the associated THREAD CREATE statement, the thread will have an initial suspend count of 1.  In that case, execution of the thread will only begin when a THREAD RESUME statement is executed, using the thread handle stored in hThread to identify the thread.

Restrictions

The THREAD RESUME 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, but logically, cannot decrement its own suspend count.

See also

FUNCTION/END FUNCTION, THREAD CLOSE, THREAD Code Group, THREAD CREATE, THREAD Object, THREAD STATUS, THREAD SUSPEND, THREADCOUNT, THREADED, THREADID