Thread.Stop

From Xojo Documentation

Revision as of 16:52, 12 November 2019 by PLefebvre (talk | contribs) (Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

Thread.Stop()

New in 2019r2

Supported for all project types and targets.

Stops the specified thread.

Notes

Internally, this method will cause your thread’s stack to unwind, destructors for local objects to be called, and so forth. It's a graceful exit which can cause code to execute. It may also cause context switches.

fa-info-circle-32.png
A thread should not stop itself. Instead, just return from the Run event handler to allow the thread to end.

Example

This example, which is in the Action event of a button, stops the thread.

LongProcessThread1.stop