diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-03-20 23:07:43 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-03-21 10:49:16 +0100 |
commit | 28ee7e13854bd518348ede61de74fdceef61e2fd (patch) | |
tree | 7f4e3c53b9109e2dac02d648fcf4cbf8ade8ad79 /tests/custom/03_stdlib/48_b64dec | |
parent | 753dea91bcfecb82fb5db646e72c9a022d2d2cbf (diff) |
uloop: add support for tasks
Tasks are similar to processes but instead of executing a new process, an
ucode function is invoked instead, running independently of the main
process.
Example usage:
uloop.init();
let t = uloop.task(
// program function
function(pipe) {
let input = pipe.receive();
pipe.send({ got_input: input });
return { result: true };
},
// parent recv function, invoked when task function calls pipe.send()
function(res) {
printf("Received output message: %.J\n", res);
},
// parent send function, invoked when task function calls pipe.receive()
function() {
let input = { test: "Example" };
printf("Sending input message: %.J\n", input);
return input;
}
);
uloop.run();
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/custom/03_stdlib/48_b64dec')
0 files changed, 0 insertions, 0 deletions