std.concurrency have `register` function for associate tid with some name and tid can be obtained by this name, but no accessors for get all associate names by tid. This information stored in private __gshared variable `namesByTid` and can be provided by function `string[] registredNames(Tid tid)` for example.
Comment #1 by razvan.nitu1305 — 2017-07-14T13:17:48Z
Comment #2 by razvan.nitu1305 — 2017-07-14T13:40:02Z
*** Issue 17231 has been marked as a duplicate of this issue. ***
Comment #3 by b2.temp — 2020-02-20T11:58:30Z
this was added at some point: Tid locate(string name);
Comment #4 by simen.kjaras — 2020-02-20T12:15:48Z
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 [];
}
}
Comment #5 by robert.schadek — 2024-12-01T16:29:53Z