www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20160] New: ThreadInfo.cleanup() clears local thread's

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

          Issue ID: 20160
           Summary: ThreadInfo.cleanup() clears local thread's registered
                    names instead of "this"'s
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: look.at.me.pee.please gmail.com

Effectively the issue is cleanup() in ThreadInfo was unregistering names for
the local thread being executed, rather than the ThreadInfo that the method was
called with.

import std.concurrency;

void main() {
    register("main_thread", thisTid());

    ThreadInfo t;
    t.cleanup(); // unregisters ThreadInfo.thisInfo Tid instead of "t"'s

    assert(locate("main_thread") == thisTid()); // fails
}

--
Aug 23 2019