diff options
author | Maria Matejka <mq@ucw.cz> | 2021-02-08 09:51:59 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-11-22 19:05:43 +0100 |
commit | 1289c1c5eede5b3d015d06b725d30024ccac51bd (patch) | |
tree | 3461d23b870f3a1c739cdea91b8a2231a70171a6 /lib/coro.h | |
parent | 1db83a507a9ae287815d62733d1337074993b433 (diff) |
Coroutines: A simple and lightweight parallel execution framework.
Diffstat (limited to 'lib/coro.h')
-rw-r--r-- | lib/coro.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/coro.h b/lib/coro.h new file mode 100644 index 00000000..51712b36 --- /dev/null +++ b/lib/coro.h @@ -0,0 +1,26 @@ +/* + * BIRD Coroutines + * + * (c) 2017 Martin Mares <mj@ucw.cz> + * (c) 2020 Maria Matejka <mq@jmq.cz> + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +#ifndef _BIRD_CORO_H_ +#define _BIRD_CORO_H_ + +#include "lib/resource.h" + +/* A completely opaque coroutine handle. */ +struct coroutine; + +/* Coroutines are independent threads bound to pools. + * You request a coroutine by calling coro_run(). + * It is forbidden to free a running coroutine from outside. + * The running coroutine must free itself by rfree() before returning. + */ +struct coroutine *coro_run(pool *, void (*entry)(void *), void *data); + + +#endif |