On Thursday, 2 October 2014 at 10:37:02 UTC, Kevin Lamonte wrote:
Would PR https://github.com/D-Programming-Language/phobos/pull/1910 provide a way given a Tid to determine: a) What underlying concurrency model it is using (Thread, Fiber, process, future)? b) Uniquely identify that structure (Thread ID string, Fiber address string, process ID, something else)? c) Be capable of using that identifying immutable (because it needs to be send()able to another Tid writing to network/file/etc) string-representable thing to find the original Tid again? A+B is necessary for using std.logger to debug concurrent applications, C is a very nice-to-have that comes up periodically.
register() is meant to provide a means of referring to a thread. But the relevant thing there is finding a thread by role, not by instance. So if a thread doing a known job terminates, a new one can spawn and register under the same name so proper operation can continue. Having an identifier for logging is a bit different. Would using the MessageBox address be sufficient? I'd be happy to add a Tid.id property that returns a value like this. I'd rather not try to generate a globally unique identifier though (that would probably mean a UUID, which is long and expensive to generate).