3 ms·
Lthread - A coroutine lib with multicore support
- pavlov 15y agoSeems quite interesting. I wish there was a more thorough explanation about how lthreads map to actual threads and the effects of that. What can run in parallel, when does the scheduler take over, what state can be shared without locks? It seems clear that there has to be some limitations compared to traditional single-thread coroutines, but the documentation doesn't explain that. (Conversely, it needs to be more explicit about the advantages of lthreads as well. Coroutines in C are not that all that well known...)
- halayli 15y agothanks for the feedback. I'll make sure to document it more extensively. When you create a pthread, it creates an lthread scheduler in it, and any lthread created in this pthread will get associated with the pthread itself. A typical example is to create a global listener socket fd and have several pthreads, each accepting on the same fd and creating lthreads to handle it. the lthreads created in each pthread will stay in their pthread. It has no limitations to traditional single-thread coroutines btw.