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