I have now written a binding for the synchronous scheduler.
Not checked for GC compliance.

WIth this we can launch fthreads inside a function like this:

///////////////////
include "std/felix/sync";
open SyncControl;

noinline fun f():int = {
   var lst = #fthread_list;
   var sched = scheduler (lst); 

   proc a () { 
      println$ "An fthread a"; 
      var ch = mk_schannel[string]();
      spawn_fthread { println$ "Fthread b"; println$ read ch;};
      spawn_fthread { println$ "Fthread c"; write (ch, "hello"); };
   }

   var clsa = cont a;
   var fthr = fthread clsa;
   push_back (lst,fthr);
   println$ "Running scheduler ..";
   run sched;
   println$ "..Scheduler run";
   delete sched;
   delete lst;
   return 1;
}

println$ f();
//////////////////

This is messy but can be cleaned up. 
[



--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to