THREAD Code Group

Purpose

The THREAD Code Group offers a collection of statements which allow you to create and manipulate additional threads of execution in your programs.

Syntax

THREAD DirectorWord [params]

THREAD DirectorWord [params] TO ReturnVariable(s)

Remarks

A Windows thread is a smaller "program-within-a-program", that runs concurrently with the main thread and other threads in the same application program.  Threads provide powerful ways for an application to perform several tasks at the same time.

With the advent of multi-core CPU's and multi-CPU computers, it's clearly desirable to encapsulate all of the information about a particular thread in a single component.  For that reason, PowerBASIC has introduced the concept of a THREAD OBJECT.  While the THREAD Code Group will be supported for some time, we recommend that all new code use THREAD OBJECTS exclusively.  They provide much greater control, and much better thread parameter handling for the programmer.

Restrictions

Functions from the Thread Code Group and THREAD OBJECTS may co-exist in the same application.  However, it is important that they not be intermixed referencing the same thread.

See also

FUNCTION/END FUNCTION, THREAD CLOSE, THREAD CREATE, THREAD GET PRIORITY, THREAD Object, THREAD RESUME, THREAD STATUS, THREAD SUSPEND, THREADCOUNT, THREADED, THREADID, THREADSAFE option descriptor