Thread communication

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 5 07:51:26 PDT 2015


On Wednesday, 5 August 2015 at 14:34:42 UTC, Alex Parrill wrote:
> On Wednesday, 5 August 2015 at 14:31:20 UTC, Marc Schütz wrote:
>> Maybe we can lift this restriction if we know that the 
>> thread's main function is pure and takes no references to 
>> mutable data, because then it can by definition never mess up 
>> the program's state.
>
> That'd be a pretty useless thread; how would it communicate 
> results back to the main thread (or wherever it should go)?

It could return something. `std.concurrency.Tid` would have to be 
extended with a `join()` method that returns its result. Or we 
could somehow allow sending and receiving data.


More information about the Digitalmars-d-learn mailing list