Large (>32 byte) concurrency messages

David Nadlinger code at klickverbot.at
Thu Aug 8 14:16:32 PDT 2013


On Thursday, 8 August 2013 at 20:08:11 UTC, JR wrote:
> I put together http://dpaste.dzfl.pl/d7322971 earlier to 
> demonstrate some of these errors, though I didn't mention the 
> raciness of passing pointers there. To test that race I used 
> http://dpaste.dzfl.pl/e6fd4569.

That's just a bug in your code; when taking a pointer to stack 
data (which is un- at safe), you have to take care not to escape it 
from the scope.

> Are there any easy workarounds? Do people use std.concurrency, 
> or is it largely avoided? Variant also seems to have some major 
> issues... or maybe everything is caused by Variant and 
> std.concurrency just exposes it.

Yep, the two issues are really just bugs in std.variant. 
std.concurrency itself is pretty nice and should be rather 
stable. The only major impediment is that 'shared' isn't really 
anywhere near useful right now, so you have to pretty much 
manually add/remove it when processing messages that contain 
mutable indirections (and hope you don't screw up in the process).

David


More information about the Digitalmars-d-learn mailing list