Erick Tryzelaar wrote:
> ------------------------
> var x = 0;
> var y = 0;
> var z = 0;
> parallel {
>   x = 1; print x; endl;
> } {
>   y = 2; print y; endl;
> } {
>   z = 3; print z; endl;
> };
>
> print x; endl;
> print y; endl;
> print z; endl;
> ------------------------

Refinement and possible pseudo implementation (not sure about variable 
length arrays yet)

------------------------
var x = 0;
var y = 0;
var z = 0;
parallel {
  x = 1; print x; endl;
}, {
  y = 2; print y; endl;
}, {
  z = 3; print z; endl;
};

print x; endl;
print y; endl;
print z; endl;
------------------------

proc parallel (functions:varray[unit->void]) {
  var pch = Pthread::mk_pchannel[unit]();

  Varray.iter (proc f =>
    Pthread::spawn_pthread { 
      f;
      Pthread::write (pch,());
    };    
  ) functions;

  var u: unit;
  Varray.iter (proc f =>
    Pthread::read (&u,pch);
  ) functions;
}

------------------------


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to