Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I do have few small code snippets + examples in the docs.

https://github.com/halayli/lthread/tree/master/src/examples

thanks for the heads up. :)



I would like to know something here. Since there is only 1 stack for a pThread and the stack state is swapped on a context switch for a co-routine within a pThread, wouldn't this be quite expensive if there are a lot of variables on stack for that co-routine? Or is the swapping being carried out in a different manner, eg. caching, pre-allocated stacks, etc..


If you don't have large variables allocated on the stack, the copy is quite fast. This is easily avoidable by allocating on the heap.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: