2017-11-14 13:13:45 +00:00
|
|
|
#ifndef MM_COROUTINE_CACHE_H
|
|
|
|
#define MM_COROUTINE_CACHE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* machinarium.
|
|
|
|
*
|
|
|
|
* cooperative multitasking engine.
|
2020-04-02 11:00:56 +00:00
|
|
|
*/
|
2017-11-14 13:13:45 +00:00
|
|
|
|
|
|
|
typedef struct mm_coroutine_cache mm_coroutine_cache_t;
|
|
|
|
|
2020-12-28 10:43:31 +00:00
|
|
|
struct mm_coroutine_cache {
|
2020-04-02 11:00:56 +00:00
|
|
|
int stack_size;
|
|
|
|
int stack_size_guard;
|
2018-11-19 14:52:37 +00:00
|
|
|
mm_list_t list;
|
2020-04-02 11:00:56 +00:00
|
|
|
int count_free;
|
|
|
|
int count_total;
|
|
|
|
int limit;
|
2017-11-14 13:13:45 +00:00
|
|
|
};
|
|
|
|
|
2020-12-28 10:43:31 +00:00
|
|
|
void mm_coroutine_cache_init(mm_coroutine_cache_t *, int, int, int);
|
|
|
|
void mm_coroutine_cache_free(mm_coroutine_cache_t *);
|
|
|
|
void mm_coroutine_cache_stat(mm_coroutine_cache_t *, uint64_t *, uint64_t *);
|
2017-11-14 13:13:45 +00:00
|
|
|
|
2020-12-28 10:43:31 +00:00
|
|
|
mm_coroutine_t *mm_coroutine_cache_pop(mm_coroutine_cache_t *);
|
2017-11-14 13:13:45 +00:00
|
|
|
|
2020-12-28 10:43:31 +00:00
|
|
|
void mm_coroutine_cache_push(mm_coroutine_cache_t *, mm_coroutine_t *);
|
2017-11-14 13:13:45 +00:00
|
|
|
|
|
|
|
#endif /* MM_COROUTINE_CACHE_H */
|