[fpc-pascal] Threading vs Parallelism ?

Marco van de Voort marcov at stack.nl
Thu Apr 20 12:05:20 CEST 2017

In our previous episode, Mark Morgan Lloyd said:
> > They are not really threads. They must be scheduled within threads.
> > https://msdn.microsoft.com/en-us/library/windows/desktop/ms682661(v=vs.85).aspx
> > from the article they don't seem to have that many advantages, except toconvert existing manual m:n scheduling apps.
> Which effectively makes them coroutines, but since they're MS-only 
> they're nonportable.

What exactly makes them coroutines? Maybe that they  implement a local stack
concept.  But you still would have to integrate that with FPC (exception
handling, stack checking), so at the basic level it only saves some asm
switching contexts.

But maybe the OS support for stack switching makes things like keeping SEH
working easier. (not that that is enabled by default for 32-bit windows x86)

> Which is more or less where Ryan started off the 
> other thread.

It suddenly occured to me that that piece of code is compatible to nothing
in FPC, since the only likely target in FPC (win32 x86) doesn't use SEH.
There is a define to enable it though ( -dTEST_WIN32_SEH )

More information about the fpc-pascal mailing list