| aMulti_Run13 | 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. |
| i2 | - | An int value passed to the subprocess. |
| i3 | - | 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 three int values as input parameters to the subprocess. (The numbers in the routine name correspond to one char value and three int values.) 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,int,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_Run13(1,3,10,100,200,300);
}
(TEA file stored in file slot 1)
#include <aMulti.tea>
void main(char callingProcID, char c, int i1, int i2, int i3)
{
aMulti_Halt(callingProcID,i1+i2+i3+c);
}
The first program (0) runs the second program (1) as process 3. The first program passes a char with a value of 10, an int with a value of 100, an int with a value of 200, and an int with a value of 300 to the subprocess. After executing the aMulti_Run13 command, the first program waits until the second program completes execution. The second program exits and returns a value of 610 to the first program (the sum of all the input parameters). The first program assigns that return value to variable n.
Related: