[fpc-pascal] Coroutines and VirtualAlloc

Ryan Joseph ryan at thealchemistguild.com
Wed Apr 19 10:37:31 CEST 2017


> On Apr 19, 2017, at 3:28 PM, Mark Morgan Lloyd <markMLl.fpc-pascal at telemetry.co.uk> wrote:
> 
> It is possible to partially-simulate coroutines with setjmp/longjmp, but you need to store state outside the function. The key thing about coroutines, at least as implemented by Wirth in Modula-2, is that you can transfer arbitrarily between them i.e. it's not just a case of a scheduler selecting one specific task which runs and then returns.

I only used coroutines in Lua and they were basically a way for a control structure like a loop to return control the main program without using threading. From the descriptions it sounds like longjmp moves the current point of execution of the program (if that concept exists like I imagine it does) so you could step in and out of loops or functions. If not that then what do those functions actually do?

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list