Re: Bartosz asks What’s Wrong with the Th

Sjoerd van Leent svanleent at gmail.com
Thu Jul 9 03:12:02 PDT 2009


Bartosz Milewski Wrote:

> Walter Bright Wrote:
> 
> > http://www.reddit.com/r/programming/comments/8z3wm/whats_wrong_with_the_thread_object/
> 
> The bottom line of this post is that the current Thread object in D should be abandoned and replaced by a more primitive "spawn" function. If there are no serious objections, we are going to proceed with the rewrite.


If you'd like, perhaps a nice template that would be able to curry would be nice. So, for example (hypothethically):

void my_func(int a, int b)
{
    writefln("%d", a+b);
}

int main(char[][] args)
{
    auto thread << spawn!(my_func, 8);
    thread.run(9);
    while(thread.running())
    {
        yield();
    }
    return 0;
}


output:
17





More information about the Digitalmars-d mailing list