Futurism lib (futures in D)
Kevin Bealer
kevinbealer at gmail.com
Sun Jan 21 06:19:26 PST 2007
I posted my future implementation dsource.org. It's called "Futurism". Here
is a simple example of using it:
int main()
{
// Create a pool of 5 threads
ThreadPool P = new ThreadPool(5);
scope(exit) P.stop;
alias Future!(char[]) FVec;
char[] a = args[1], b = args[2], c = args[3];
// Starting reading two files at once:
FVec f1 = new FVec({ return cast(char[]) read(a); });
FVec f2 = new FVec({ return cast(char[]) read(b); });
int total_length = f1.value.length + f2.value.length;
writefln("total length is %s", f1.value.length + );
return 0;
}
More information about the Digitalmars-d-announce
mailing list