| aMulti_Run00 | Index |
Definition:
Parameters:
| fileID | - | The index of the TEA file to be run as a subprocess. |
| ProcID | - | The index of the process which will execute the TEA file. |
Return Value:
Description:
This routine runs a TEA file in a specific process slot as a subprocess. The calling routine waits until the subprocess is finished before it resumes execution. The subprocess behaves as a subroutine. This provides a means for extending TEA programs beyond the 1K allocation for a single CUP (compiled TEA) file. The typical approach is to run a top-level TEA file as process 0 which runs other TEA files as subprocesses. A file that is run at power-up will automatically start as process 0. The GP 1.0 Module can run 4 processes.
The subprocess must be declared as "void main(char)" and be terminated with a call to subroutine aMulti_Halt. The aMulti_Halt command will signal completion of the subprocess via a semaphore and pass a return value back to the calling process.
Example:
(TEA file stored in file slot 0)
#include <aMulti.tea>
void main()
{
int n;
n = aMulti_Run00(1,3);
}
(TEA file stored in file slot 1)
#include <aMulti.tea>
void main(char callingProcID)
{
aMulti_Halt(callingProcID,100);
}
The first program (0) runs the second program (1) as process 3. After executing the aMulti_Run00 command, the first program waits until the second program completes execution. The second program exits and returns a value of 100 to the first program. The first program assigns that return value to variable n.
Related: