4 ms·
So looking at that. I will say if you look at the API exposed in "libco.h" it's does not offer a ton options other than context switching cothread_t co_active(
by anfilt 4y ago
So looking at that. I will say if you look at the API exposed in "libco.h" it's does not offer a ton options other than context switching
cothread_t co_active(void);
cothread_t co_derive(void, unsigned int, void ()(void));
cothread_t co_create(unsigned int, void (*)(void));
void co_delete(cothread_t);
void co_switch(cothread_t);
int co_serializable(void);
Also it uses malloc to create the stacks. My library lets decide how wish to allocate stacks with. On linux I recommend mmap since you can create guard pages and such, but it's completely up to. Also I have functions that can let you call an other function on thread stack. This is handy to let you call a function that generates a deep call stack. Otherwise you have to mess around hopping back and forth between couroutines and the main thread context.