On 20/04/17 09:00, Marco van de Voort wrote:
In our previous episode, Mark Morgan Lloyd said:> > I don't know. Such effort should 
chiefly come from the people interested init I guess.> > Turning it around a little: are 
there still FPC targets that don't have > threads? Having coroutines would allow a native 
thread mechanism to be > implemented, without relying on the underlying OS.
No, since the code would be for preemptive systems, and the coroutine systemis 
cooperative.

But once you have coroutines as a way of managing context it's not particularly difficult to define one which receives control on a timer tick or when nothing else is happening, and that schedules another on the basis of priority or simply round-robin.

Being able to switch context, which in practice means switching the stack frame, is a prerequisite to having threads, just as threads are a prerequisite of having processes.

I don't quite know where exception handling would fit into this.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to