| aStash_ByteWr | Index |
Definition:
Parameters:
| ProcID | - | The ID of the stash process. |
| index | - | The index of the byte to be written in the stash. |
| data | - | The byte to be written in the stash. |
Return Value:
Description:
This routine writes a byte to a stash process. Each process has a fixed amount of RAM in its local stack space. A stash process may be used to give other processes access to additional RAM. A stash process runs in an infinite loop and processes read or write requests. Semaphores synchronize the communication between processes. When not processing requests, the process is stalled so that other processes may fully utilize the CPU. The current implementation of a stash process stores 116 bytes in its local RAM space. The overhead for processing these requests makes the access time much slower than using local stack space or the scratch pad.
Example:
(TEA file stored in file slot 0)
#include <aMulti.tea>
#include <aStash.tea>
int main()
{
int n;
aMulti_Spawn(1,3);
aStash_ByteWr(3,0,44);
n=aStash_ByteRd(3,0);
aMulti_Kill(3);
return(n);
}
(TEA file stored in file slot 1)
#include <aMulti.tea>
#include <aStash.tea>
void main(char callingProcID)
{
aStash_ByteGo();
}
The first program (0) runs the second program (1) as process 3. The second program is a byte stash. After launching the stash process with the aMulti_Spawn command, the first program writes a value to the stash. The first program then reads back the value from the stash, terminates the stash, and returns the retrieved value on exit.
Related: