WaitForAllJobs
Use the WaitForAllJobs
function to instruct a main process to wait for
all specified asynchronously executed processes to complete before continuing the main
process.
This function is valid only in TurboIntegrator processes and only on TM1 Database 12.
Syntax
WaitForAllJobs(JobID1, JobID2, JobID3...);
Argument |
Description |
---|---|
JobID1, JobID2, JobID3... |
The ID of a process executed asynchronously from within the main process. |
Example
JobId1 = RunProcess(`async_process_1`);
JobId2 = RunProcess(`async_process_2`);
#*** Do something else in the process
ret = WaitForAllJobs(JobId1, JobId2);
A main process can execute other process asynchronously by using the RunProcess
function, as shown in this example where two asynchronous processes are executed.
The RunProcess
function returns a JobId in string format if it successfully
launches an asynchronous process. Later on in the main process, the JobIds can be provided as
arguments to the WaitForAnyJobs
function.
In this example,WaitForAnyJobs(JobId1, JobId2)
blocks the main process and waits
for both JobId1 (async_process_1) or JobId2 (async_process_2) to finish before continuing the
main process.
The return value of WaitForAnyJobs
is 1 if the wait is successful, 0 if the wait
fails.