function is `@nogc` yet allocates closures with the GC work around!
workman at gmail.com
Tue Jan 11 15:20:00 UTC 2022
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.
Thanks, after add scope into doTask this work.
One more question:
The delegate in doTask is execute in a nogc nothrow native
thread, before goto doTask I yield fiber. when native thread
work done I call the fiber to continue run it.
The fiber will never be touched before work done callback
finished. The fiber always destroy after scope exit.
In the native thread I call the delegate closures, the closures
runtime stack will use native thread stack since there is no
fiber switch. (bu it will read/write fiber stack vars), and all
stack vars will be destroyed after delegate closures scope quit.
After modify fiber stack vars from native thread, then send
message to D thread, D thread call fiber again, from there it
always access the updated fiber stack value?
More information about the Digitalmars-d