RunGlobalProcedureAsyncGetCurrent
- Last UpdatedOct 29, 2026
- 2 minute read
RunGlobalProcedureAsyncGetCurrent is a built-in function that gets the thread ID of the procedure from which it is called, as long as the procedure was originally run by calling the RunGlobalProcedureAsync function.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
RunGlobalProcedureAsyncGetCurrent |
Module Activity |
Synchronous |
No |
Supported |
Not supported |
Not supported |
Not supported (see Notes below) |
Not supported |
Syntax
RunGlobalProcedureAsyncGetCurrent()
RunGlobalProcedureAsyncGetCurrent ( )
This function has no parameters.
Return value
If this function succeeds, it returns the thread ID of the procedure from which it was called. It is the same ID that was returned by the RunGlobalProcedureAsync function when that function was called to run the procedure, and the ID can be subsequently passed as an argument to the RunGlobalProcedureAsyncGetStatus function.
If this function fails, it returns one of the following possible values:
|
Value |
Description |
|---|---|
|
-1 |
Function was not called from a procedure running asynchronously. |
Notes
It is important to note this function can be called only in background tasks (such as Math, Scheduler, and VBScript Script) by the project runtime server. It cannot be directly called by any project viewer or thin client, even if it is on the same computer or device as the server, because the project viewer runs in its own thread separate from the project runtime server. To indirectly call this function, configure a Math or VBScript scripts (script groups) worksheet to execute on a tag/expression trigger, and then configure a project screen to activate the trigger when needed. For example, configure the worksheet to execute when the value of MyTag is 1, and then configure a Button object in a project screen to toggle the value of MyTag.
This function can be used only to get the thread ID of the procedure from which it is called, because that procedure runs asynchronously in its own thread. This function cannot be used to get the thread IDs of any other procedures, even if those procedures were also run by calling the RunGlobalProcedureAsync function. If you need to build a list of all of the procedures that are currently running, you can have each procedure call this function for itself and then store all of the returned values.