summaryrefslogtreecommitdiffhomepage
path: root/tests/custom
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-03-20 23:07:43 +0100
committerJo-Philipp Wich <jo@mein.io>2022-03-21 10:49:16 +0100
commit28ee7e13854bd518348ede61de74fdceef61e2fd (patch)
tree7f4e3c53b9109e2dac02d648fcf4cbf8ade8ad79 /tests/custom
parent753dea91bcfecb82fb5db646e72c9a022d2d2cbf (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')
0 files changed, 0 insertions, 0 deletions