Are structs saved in multi-thread delegate call?

ed via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 22 19:55:33 PDT 2016


On Saturday, 23 April 2016 at 01:11:49 UTC, Ramon wrote:
> mmm, I figured the problem, but don't know how to solve it.
> my struct has a destructor which clears itself:
>
> struct json_value
> {
>   ~this() { .ValueClear(&data); }
> }
>
> so how I can I put a struct in the heap? (not in the stack, as 
> is the default..)

new or make with arg or new or make then opAssign or this(this).

but have you tried

     __ghsared immutable json_value cbk = json_value(prms.argv[3]);

? without __gshared cbk might be on the TLS. (see with -vtls 
switch on DMD)


More information about the Digitalmars-d-learn mailing list