Functional style - examples

Not sure if I’m going too low level for you… but I believe co-routines could be implemented with Fibers for some use cases anyway.

https://nullprogram.com/blog/2019/03/28/

From @Glen_Kleidon2 Melbourne talk this month, he was talking about a missing WriteAsync function in delphi. The actual IO could be handled by a IO Completion Port or using Overlapped IO. Once the Write call has been scheduled… the WriteAsync call would switch to/or create another fibre that is waiting on the IO port… which would then use SwitchToFiber to load back to code to continue the function that called WriteAsync. Sleep calls could be handled in a similar fashion - Using CreateWaitableTimer.

1 Like