Re: Cothreads in glib 2.0?



Hi Erik,

> Has any thought been given to including cothread (aka coroutines) in glib
> 2.0?  I'm willing to do all the work to get this in glib 2.0, and have a
> significant glib-like codebase to start from.
> 
> If anyone wants to see the code I'd start from, go to the CVS browser on
> http://gstreamer.net/ and look at gstreamer/gst/cothread.[ch].  More work
> would be needed, but I think it'd be a valuable addition to glib.

I looked at your implementation, but I'm not so sure we want to play
setjmp/longjmp tricks in GLib. Also your implementation depends on pthreads
(though that should be not too hard to change), which is only one of GLibs
supported thread systems. 

But I don't feel very strongly about this issue. All those setjmp/longjmp
threads (like pth) of course are nice in certain ways (you do not need such
complex locking as for real threads, but we already have the complex locking
in GLib, so that wont save us a single mutex), but in other respects they are
not so nice: All cothreads block on blocking operations (select, read, etc.)
and the scheduling is cooperative. So I don't think, we should add that to
GLib, but OTOH I don't have anything against doing it ;-) Try to convince the
GLib gods.

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]