skaller wrote:
> Probably .. but it smacks of just using a library
> function. The problem here is that you'd need to
> fold over a list:
I already did a library implementation, with a test and everything :) I
sent it out, oh, about 4 hours ago. Did you not get it? If not, here it
is again:
#import <flx.flxh>
#include <pthread.flx>
proc parallel[N] (functions:array[unit->void, N]) {
var pch = Pthread::mk_pchannel[unit]();
var i: int;
forall i in 0 upto (len functions) - 1 do
Pthread::spawn_pthread {
functions.[i] ();
Pthread::write (pch,());
};
done;
var u: unit;
forall i in 0 upto (len functions) - 1 do
Pthread::read (&u,pch);
done;
}
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;
Output:
1
2
3
1
2
3
-------------------------------------------------------------------------
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