From: Paul K. <pk...@gm...> - 2013-04-13 15:00:50
|
Stig Hemmer wrote: > On Sat, Apr 13, 2013 at 3:22 PM, Vsevolod Dyomkin<vse...@gm...>wrote: > >> On Sat, Apr 13, 2013 at 4:08 PM, Stig Hemmer<sti...@gm...> wrote: >> >>> Isn't coroutines trivial with threads? >>> >> I'm talking here about the cooperatively scheduled coroutines. >> > > So was I. Sorry about being too short. > > Threads and coroutines are not the same thing, obviously, but it seems to > me that threads are powerful enough to be used to implement a coroutine > library without a whole lot of effort. That's right, and if all you want is cooperative threading, it may be good enough. GNU Pth works that way, nowadays. However, that's pretty much the worst of both worlds: heavyweight system threads with locking, and you still have to schedule them manually. I expect many people who would like to see (full) coroutines expect some sort of performance gain over plain threads, in return for being willing to manage task switching manually. Paul Khuong |