0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-15 07:38:43 +00:00
bird/lib/coroutine.h
2018-09-14 14:39:56 +02:00

27 lines
607 B
C

/*
* BIRD Coroutines
*
* (c) 2017 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#ifndef _BIRD_COROUTINE_H_
#define _BIRD_COROUTINE_H_
#include "lib/event.h"
// The structure is completely opaque, implemented by sysdep
typedef struct coroutine coroutine;
coroutine *coro_new(struct pool *pool, void (*entry_point)(void *arg), void *arg);
void coro_suspend(void);
void coro_resume(coroutine *c);
void coro_done(event *e) NORET;
struct birdsock;
int coro_sk_read(struct birdsock *s);
void coro_sk_write(struct birdsock *s, unsigned len);
#endif