On Tue, 2007-08-21 at 16:40 +0300, Rhythmic Fistman wrote: > On 8/19/07, skaller <[EMAIL PROTECTED]> wrote: > > On Sun, 2007-08-19 at 13:13 +0300, Rhythmic Fistman wrote: > > > > > My driver itself cheats in this respect, using > > > an schannel with some c code that reschedules every fthread > > > hanging on an schannel, as though you executed a "read n times, > > > discarding result". Um. > > > > I actually think you should use the standard driver. > > Well, that wouldn't be so hard - apart from hiding the flx > rtl headers behind an apaque void*, it only really adds one > thing*: the ability to dump all the readers of an schannel > back into the active list, that is it "fakes" N writes. > I tried rewriting that in felix using real writes, but I get > gc "removed non root" errors and the whole thing's a bit hairy, > as the code written uses svc calls and can't be guaranteed > to finish by simply executing its continuations. I need > to be able to do this step in one fell swoop. The motivation > for all this is that my driver + support flx file provides > a global synchrosing timer where n fthreads can run, then > at a certain point, asked to be suspended for n time units. > I implement this on the fthread side via reads on an schannel, > descheduling the fthreads and on the driver side dumping all > those fthreads back onto the active list with the fake writes.
But this is trivial. You're basically wanting broadcasting: tick --> [ subscriber list ] tick --> A tick --> B tick --> C which can be done like: spawn_fthread { forever { read (&x, in_chan); var i = 0; while {i<n} { write (out_chan.[i], x); ++i; }; }; } This is a dumb example with a fixed length array of subscriber channels: a list would probably be better. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language