Some Issues in DSharp tFiber

Issue #41 new
Former user created an issue

Hello all,

I'm playing with DSharp fibers and I think I've stumbled over some issues in Unit "DSharp.Core.Fibers'.

First of all, I believe that a tFiber running in "lkImmediate" mode has no way of stopping cleanly... The method "Run" will only exit properly if fLoopKind changes value to lkNone and there is no way to do this (it is a read only property).

"Run" also tries to exit if an exception is raised. But I believe there's a GPF bug lurking there: if fFreeOnTerminate is true, the object is destroyed, but subsequently it still accesses some members when it calls SwitchToMainThread() and Yield().

Kind regards, Arthur Hoornweg

Comments (1)

  1. Stefan Glienke repo owner

    I think lkImmediate was originally designed to run infinitely unless you use Abort - I honestly don't even remember anymore.

    Same goes for the FreeOnTerminate property which I probably just put there for API compatibility to TThread but obviously that would not work as currently being implemented.

    Anyway I will not take any actions about this since the defect functionality is nowhere used within the library itself and I reimplemented fiber/coroutine in Spring4D some while ago but did not release yet (it needs some review and testing). If you are experienced in that area I can give you access.

  2. Log in to comment