function is `@nogc` yet allocates closures with the GC work around!

bauss jj_1337 at live.dk
Wed Jan 12 14:06:53 UTC 2022


On Tuesday, 11 January 2022 at 15:47:58 UTC, workman wrote:
> On Tuesday, 11 January 2022 at 13:32:58 UTC, Dennis wrote:
>> On Tuesday, 11 January 2022 at 11:56:39 UTC, workman wrote:
>>> Is there a workaround to made this work ?
>>
>> Make sure `doTask` takes a `scope` delegate.
>
> To simple the question further:
>
> step 1) A thread send the pointer into thread B by message
>
> step 2) Thread B modify pointer value
>
> step 3) Thread B send message to let Thread A know the work is 
> done
>
> step 4) Thread A read the pointer and get the value.  (in here 
> Thread A always read the value updated by Thread B? )

Let me change your analogy and perhaps it will answer your own 
question.

step 1) Person A shares a piece of paper with Person B
step 2) Person B writes something on the piece of paper
step 3) Person B gives the piece of paper back to Person A
step 4) Person A reads the piece of paper



More information about the Digitalmars-d mailing list