Thread Class Summary

The following pages provide detailed information on the methods of the Thread Class. This class provides the means for starting, stopping, and monitoring the execution of independent threads.

The GPL system supports the simultaneous execution of up to 64 GPL program threads. Each thread has its own execution stack and runs independently of all other threads. If multiple threads are active, each thread executes for up to 1 millisecond before control passes to the next ready thread.

When a GPL project is loaded, one procedure is designated as the main procedure in the project file settings. This main procedure is started by the GDE interface, the web Operator Control Panel, the Start console command, or automatically when the system is restarted.

The main procedure can then start additional procedures as separate threads.

Table 19-104 summarizes the methods and properties that are described in greater detail in the following sections

Table 19-104: Thread Class Summary

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.