[Issue 17234] access to registered thread names

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 20 12:15:48 UTC 2020


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

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |simen.kjaras at gmail.com
         Resolution|WORKSFORME                  |---

--- Comment #4 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
locate goes the opposite way: Given a name, get the tid. What's being requested
here is given a tid, get the name(s).

Something like this:

/**
 * Gets the names associated with tid.
 *
 * Params:
 *  tid = The Tid to locate within the registry.
 *
 * Returns:
 *  The associated names or null if tid is not registered.
 */
string[] locate(Tid tid) {
    synchronized (registryLock)
    {
        if (auto name = tid in namesByTid)
            return *name;
        return [];
    }
}

--


More information about the Digitalmars-d-bugs mailing list