Thread.State

From Xojo Documentation

Read-Only Property (As Integer )
IntegerValue = aThread.State

New in 2005r1

Supported for all project types and targets.

Indicates the state of the thread.

Notes

A thread can be in one of five states. The states can be identified via the following class constants:

Value Class Constant Description
0 Running The thread is running normally.
1 Waiting The thread has been blocked by a call to Signal or Enter from one of the locking mechanisms, CriticalSection, Mutex, or Semaphore.
2 Suspended It will not execute because of a call to the Suspend method.
3 Sleeping It has been put to sleep by a call to the Sleep method.
4 NotRunning The thread will be in this state prior to a call to Run or after the thread has finished running.

Sample Code

This window method checks the State of the thread and displays a message in a TextField on the form. The parameter is:

State As Integer
Select Case State
Case thread.Running
TextField1.Text = "Running"
Case thread.Waiting
TextField1.Text = "Waiting"
Case thread.Sleeping
TextField1.Text = "Sleeping"
Case thread.Suspended
TextField1.Text = "Suspended"
Case thread.NotRunning
TextField1.Text = "Not Running"
End Select