|Navigation: Language Reference > 13 - Built-in Functions >====== THREAD (return current execution thread) ======|
The THREAD procedure returns the currently executing thread number. The returned thread number can be used by procedures and built-in procedures whose action may be performed on any execution thread (such as SETTARGET).
The maximum number of simultaneously available execution threads in a single application is theoretically unlimited. However, the word “unlimited” means that limits are applied not by the Clarion Runtime Library, but by the Operating System's environment settings, i.e., limited to the amount of virtual memory available for the process, or limited number of threads in the system, or limited number of windows (including controls) that can be opened simultaneously in the process, etc. Therefore, THREAD always returns a value in the range of one (1) to the upper limit of the SIGNED integer (2,147,483,647).
Return Data Type: SIGNED
MainWin APPLICATION('My Application'),SYSTEM,MAX,ICON('MyIcon.ICO'),STATUS |
SaveThread LONG !Declare thread number save variable
SaveThread1 LONG !Declare thread number save variable
SaveThread2 LONG !Declare thread number save variable
SaveThread = THREAD() !Save thread number
OPEN(MainWin) !Open the APPLICATION
ACCEPT !Handle Global events
SaveThread1 = START(NewProc1) !Start a new thread
SaveThread2 = START(NewProc2) !Start a new thread