diff --git a/std/concurrency.d b/std/concurrency.d index 1c2859d806d..b7e371fb5fd 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -321,6 +321,22 @@ private: MessageBox mbox; + +public: + + /** + * Generate a convenient string for identifying this Tid. This is only + * useful to see if Tid's that are currently executing are the same or + * different, e.g. for logging and debugging. It is potentially possible + * that a Tid executed in the future will have the same toString() output + * as another Tid that has already terminated. + */ + void toString(scope void delegate(const(char)[]) sink) + { + import std.format; + formattedWrite(sink, "Tid(%x)", &mbox); + } + } @@ -1447,6 +1463,7 @@ private size_t m_localMsgs; size_t m_maxMsgs; bool m_closed; + }