Re: What is safe to do in an extern (C) function and how can I test this?

2022-01-24 Thread Jaime via Digitalmars-d-learn
On Tuesday, 25 January 2022 at 01:41:03 UTC, Steven Schveighoffer wrote: On 1/24/22 8:31 PM, Jaime wrote: Can I, for instance, safely call Fiber.yield in a C callback that I know will be run in a Fiber? I would *imagine* it's fine, all the fiber context switch is doing (WRT the stack) is

Re: What is safe to do in an extern (C) function and how can I test this?

2022-01-24 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jan 25, 2022 at 01:31:29AM +, Jaime via Digitalmars-d-learn wrote: > **The lede**: > > Can I, for instance, safely call Fiber.yield in a C callback that I > know will be run in a Fiber? > > The stack will look like: > Thread > |- Fiber in D runtime > | |- Call into a C API (stays on

Re: What is safe to do in an extern (C) function and how can I test this?

2022-01-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/24/22 8:31 PM, Jaime wrote: **The lede**: Can I, for instance, safely call Fiber.yield in a C callback that I know will be run in a Fiber? The stack will look like: Thread |- Fiber in D runtime | |- Call into a C API (stays on same thread) | | |- Extern (C) callback (stays on same

What is safe to do in an extern (C) function and how can I test this?

2022-01-24 Thread Jaime via Digitalmars-d-learn
**The lede**: Can I, for instance, safely call Fiber.yield in a C callback that I know will be run in a Fiber? The stack will look like: Thread |- Fiber in D runtime | |- Call into a C API (stays on same thread) | | |- Extern (C) callback (stays on same thread) | | | |- Fiber.yield <-- Is