libtask [ http://swtch.com/libtask/ ] implements something similar/same; however, it's a coroutine lib and I'm pretty sure it will not work with multiple threads.
However, it does have something like a select() for channels, see the Alt structure and associated methods, IIRC the implementation is fairly simple. On 9 September 2010 07:21, Mate Nagy <mn...@port70.net> wrote: > Hello all, > > I guess I can't get enough of the punishment I always get in these > threads. Announcing project: > > http://repo.hu/projects/cchan/ > > 'This is a small library that implements a "channel" construct for > inter-thread communication in C programs. ' > > This is a very small and simple lib that does one thing only. > It uses mutexes and conds for synchronization; it is interfaced to the > thread API using a very thin .h file with macros. It would be probably > quite easy to port it to use other thread APIs. Currently it supports > pthreads and SDL threads. > > Doesn't use C99 or gcc-specific features, hopefully. > > Future development: would be nice to implement a select() operation for > listening on multiple channels at once; would probably also be very > complicated. > > Regards, > Mate > > PS. I'm fully aware that Plan 9 has this functionality built in. Not > interested in "you should use plan9 and/or plan9 portability libs" mails > thanx > >