2017-11-14 13:13:45 +00:00
|
|
|
#ifndef MM_COROUTINE_CACHE_H
|
|
|
|
#define MM_COROUTINE_CACHE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* machinarium.
|
|
|
|
*
|
|
|
|
* cooperative multitasking engine.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct mm_coroutine_cache mm_coroutine_cache_t;
|
|
|
|
|
|
|
|
struct mm_coroutine_cache
|
|
|
|
{
|
|
|
|
pthread_spinlock_t lock;
|
|
|
|
int stack_size;
|
2017-11-27 13:54:16 +00:00
|
|
|
int stack_size_guard;
|
2017-11-14 13:13:45 +00:00
|
|
|
mm_list_t list;
|
2018-01-09 14:37:09 +00:00
|
|
|
int count_free;
|
|
|
|
int count_total;
|
2017-11-14 13:13:45 +00:00
|
|
|
int limit;
|
|
|
|
};
|
|
|
|
|
2017-11-27 13:54:16 +00:00
|
|
|
void mm_coroutine_cache_init(mm_coroutine_cache_t*, int, int, int);
|
2017-11-14 13:13:45 +00:00
|
|
|
void mm_coroutine_cache_free(mm_coroutine_cache_t*);
|
2018-01-09 14:37:09 +00:00
|
|
|
void mm_coroutine_cache_stat(mm_coroutine_cache_t*, int*, int*);
|
2017-11-14 13:13:45 +00:00
|
|
|
|
|
|
|
mm_coroutine_t*
|
|
|
|
mm_coroutine_cache_pop(mm_coroutine_cache_t*);
|
|
|
|
|
|
|
|
void mm_coroutine_cache_push(mm_coroutine_cache_t*, mm_coroutine_t*);
|
|
|
|
|
|
|
|
#endif /* MM_COROUTINE_CACHE_H */
|