| aMulti_Run11 | 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. |
| c1 | - | A char value passed to the subprocess. |
| i1 | - | An int value passed to the subprocess. |
Return Value:
Description:
This routine runs a TEA file in a specific process slot as a subprocess. It passes a char value and an int value as input parameters to the subprocess. (The numbers in the routine name correspond to one char value and one int value.) 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,char,int)" 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_Run11(1,3,10,100);
}
(TEA file stored in file slot 1)
#include <aMulti.tea>
void main(char callingProcID, char c, int i)
{
aMulti_Halt(callingProcID,i+c);
}
The first program (0) runs the second program (1) as process 3. The first program passes a char with a value of 10 and an int with a value of 100 to the subprocess. After executing the aMulti_Run11 command, the first program waits until the second program completes execution. The second program exits and returns a value of 110 to the first program (the sum of the two input parameters). The first program assigns that return value to variable n.
Related: