The Thread Class

To control the starting, stopping, and monitoring of independent threads, GPL includes a Thread Class that includes the required methods and properties.  In Table 19-41, the members of this Class are briefly described.  Completion information on these class members are provided in the GPL Dictionary pages.

Table 19-41: Thread Class Definitions

Member Type Description

New Thread

Constructor Method   

Creates a thread object and associates it with a procedure.

thread_object.Abort

Method

Stops execution of a thread such that it cannot be resumed.

thread_object.Argument

Property

Sets or gets a numeric value that can be used as a parameter for a thread.

Thread.CurrentThread

Shared Method

Returns a thread object for the currently executing thread.

thread_object.Join

Method

Waits for a thread to complete execution, with a timeout.

thread_object.Name

Get Property

Returns a String containing the name of the thread associated with this object.

thread_object.Project

Get Property

Returns a String containing the name of the project associated with this object.

thread_object.Resume

Method

Resumes execution of a thread that was suspended.

Thread.Schedule

Shared Method

Changes the execution priority and thread scheduling algorithm for the current thread.

thread_object.SendEvent

Method

Sends an event to a thread to notify it that a significant transition has occurred.

Thread.Sleep

Shared Method

Causes the current thread to stop execution for a specified amount of time.

thread_object.Start

Method

Initializes and starts execution of a procedure as an independent thread.

thread_object.StartProcedure

Get Property

Returns a String containing the name of the start procedure associated with this object.

thread_object.Suspend

Method

Suspends execution of a thread so that it can be resumed.

Thread.TestAndSet

Shared Method

Atomically reads a numeric variable and writes a new value.  Used for restricting access to data shared between threads.

thread_object.ThreadState

Get Property

Returns an integer indicating the execution state of a thread.

Thread.WaitEvent

Shared Method

Causes the current thread to wait for an event.