ConsoleApplication.CurrentThread

From Xojo Documentation

Revision as of 01:34, 30 August 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Read-Only Property (As Thread )
ThreadValue = aConsoleApplication.CurrentThread

Supported for all project types and targets.

Obtains the currently running Thread.

Notes

If the current Thread is the main thread (the thread that it used internally to run the application), CurrentThread returns Nil.

Sample Code

This code gets the ID of the currently running thread, which should be the main thread.

Var t As Thread = App.CurrentThread
If t <> Nil Then
MessageBox("The Thread ID is " + Str( t.ThreadID ))
Else
MessageBox("The thread is the main thread")
End If