fix issue 13262 - Cannot send certain shared data to another thread#5694
fix issue 13262 - Cannot send certain shared data to another thread#5694wilzbach merged 2 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request, @schveiguy! Bugzilla references
|
send/receive. Also now allows all types of shared items to be stored in a Variant.
|
Variant was not properly removing the shared qualifier when copying data from the stack into the payload (this is always safe, as the Variant itself is not shared, so the payload, which is never accessible by reference, is also not actually shared). What if the user creates a |
Then nothing will work I think :) |
|
In other words, if you create a |
| fun!(S3)(v); | ||
| fun!(shared(S3))(v); | ||
|
|
||
| // ensure structs that are shared, but don't have shared postblits |
There was a problem hiding this comment.
It might be good to ensure that a struct that does have a shared postblit can be used.
There was a problem hiding this comment.
I tried. It can't, but not because of this code, there are a whole bunch of places where it fails. I didn't want to fix everything 😉
|
LGTM |
into account the type qualifiers.
|
I've updated to avoid using |
There were 2 major issues:
Variantwas not properly removing thesharedqualifier when copying data from the stack into the payload (this is always safe, as theVariantitself is not shared, so the payload, which is never accessible by reference, is also not actuallyshared).std.traits.ImplicitConversionTargetsincorrectly returnedconst(T)[]as a valid conversion target forshared(T)[]. It should have beenconst(shared(T))[].All the tests for the bug were ported to verifying
Variantcould accept the types, and this in turn fixes thesendandreceivefunctions (I added one unit test to verify the original test case to std/concurrency.d).