RunGlobalProcedureAsyncGetStatus
This function gets the status of one or more global procedures that were run asynchronously by calling the RunGlobalProcedureAsync function. Each procedure is run in its own thread, so that it does not slow down or interfere with other threads.
Function | Group | Execution | Windows | Embedded | Thin Client | Mobile Access |
---|---|---|---|---|---|---|
RunGlobalProcedureAsyncGetStatus | Module Activity | Synchronous | Supported | Supported | Not supported; see note | Not supported |
Syntax
RunGlobalProcedureAsyncGetStatus( ) RunGlobalProcedureAsyncGetStatus( optNumThreadID ) RunGlobalProcedureAsyncGetStatus( "optTagThreadIDs", "optTagStatus", "optTagParameters" )
- optNumThreadID
- The thread ID returned by the RunGlobalProcedureAsync function, if the procedure was successfully executed.
- optTagThreadIDs
- The name of an Array tag that will receive the thread IDs of all currently running and recently completed threads.
Note: The tag name should be enclosed in quotes, as shown in the syntax diagram, or else the function will try to use the value of the tag.
- optTagStatus
- The name of an Array tag that will receive the statuses of all currently running and recently completed threads.
Note: The tag name should be enclosed in quotes, as shown in the syntax diagram, or else the function will try to use the value of the tag.
- optTagParameters
- The name of an Array tag that will receive the parameters of all currently running and recently completed threads.
Note: The tag name should be enclosed in quotes, as shown in the syntax diagram, or else the function will try to use the value of the tag.
Returned value
- If the function was called with no parameters…
RunGlobalProcedureAsyncGetStatus( )
…then the returned value is the total number of threads that are currently running.
- If the function was called with only the optNumThreadID parameter…
RunGlobalProcedureAsyncGetStatus( optNumThreadID )
…then the returned value is either 0, indicating that the thread is still running, or the value that was returned by the procedure.
- If the function was called with the Array tags…
RunGlobalProcedureAsyncGetStatus( "optTagThreadIDs", "optTagStatus", "optTagParameters" )
…then the tags will receive the appropriate values for all currently running and recently completed threads.
Value | Description |
---|---|
-1 | Function is not supported on Viewer / Web Thin Client. |
-2 | Invalid thread ID. |
-3 | Invalid optTagThreadIDs. |
-4 | Invalid optTagStatus. |
-5 | Invalid optTagParameters. |
-100 | Internal error. Please contact technical support. |
Notes
It is very important to note that this function can only be called by background tasks (e.g., Math, Script, Scheduler) on the project server. It cannot be directly called from any project client, even if the project client is running on the same workstation or device as the project server, because the client process is single-threaded. To indirectly call the function from a project client, configure a Math or Script 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 screen object to toggle the value of MyTag when pressed.
- The RunGlobalProcedureAsyncGetStatus function has been called and the thread status is different from 0 (thread is running); or
- The maximum buffer size has been exceeded, the thread is no longer running, and a call to start a new thread has been made.