Just to remind me: Functions cannot write on schannels because that requires a service call to exchange control (unless the function is inlined away and embedded in a top level procedure layer).
However, a function *could* still spawn a fibre, provided the fibre cannot start until the machine stack is empty. Spawning a fibre is just a matter of adding an object to the scheduler list. The only problem is finding the scheduler. So I can do that. I can allow spawn_fthread anywhere. With proper scoping, because this would simply force the function to use the heap for its data frame (which is already calculated: only the return address has to go on the machine stack). There is another option. Functions can call procedures. How do they do that? The answer is, the function runs its own mini-service loop. This loop is generated by the compiler. It isn't the same as the top level loop. It cannot handle channel I/O. But it COULD .. if I just used a subroutine call to a new instance of the scheduler. Then you could spawn a fibre on THAT scheduler, and it could do channel I/O .. but only with fibres launched by that scheduler. Such a sub-scheduler is actually a complete sub-launch of Felix (minus command line option processing and garbage collector). So actually the real problem here is just deciding which way to go .. and rewriting the scheduler so it can be called as a subroutine from Felix. You can already invoke Felix from any C program .. after all, that's what flx_run already does! -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Keep yourself connected to Go Parallel: DESIGN Expert tips on starting your parallel project right. http://goparallel.sourceforge.net _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language