www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21281] New: Fiber.state race condition

https://issues.dlang.org/show_bug.cgi?id=21281

          Issue ID: 21281
           Summary: Fiber.state race condition
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: destructionator gmail.com

The implementation of Fiber.yield does:

        cur.m_state = State.HOLD;
        cur.switchOut();
        cur.m_state = State.EXEC;

This makes it useless for threaded work, the state of HOLD is set before it
actually starts holding and another thread can corrupt it.

--
Sep 27 2020