diff options
author | Maria Matejka <mq@ucw.cz> | 2022-07-18 11:11:46 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-07-18 11:11:46 +0200 |
commit | 4b6f5ee8709b2fae9da13c58bfbae21b84cd40c5 (patch) | |
tree | 988625a78e393d4b5425424b4e0f354c89cdf07a /lib/coro.h | |
parent | 9901ca6fb3683091c7eb424cbba8c7bc94e41cbb (diff) | |
parent | a4451535c69b8f934523905a8131ae2f16be2146 (diff) |
Merge commit 'a4451535' into thread-next
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 |