3 ms·
>Don't you trade for a different type of complexity in yield/resume? That depends on the library in question. Generally the event/callback style code people a
by papsosouid 14y ago
>Don't you trade for a different type of complexity in yield/resume?
That depends on the library in question. Generally the event/callback style code people are writing are only "yielding" at calls to the non-blocking version of otherwise blocking functions, like read type functions, or accept. Most userland threading libs I've seen make the assumption that you want that, and so you don't need to yield yourself. If you did want that level of control, it is still simpler than the event style of achieving the same result.
>Also you will lost some of the scalability advantages because you have to store context for all of the idle fibers.
The overhead is small, especially if you know you don't need much stack and set the thread stack size lower.