www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6989] New: Implement toString for std.concurrency.Tid

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6989

           Summary: Implement toString for std.concurrency.Tid
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



13:11:43 PST ---
Currently calling write() on a Tid prints:
Tid(std.concurrency.MessageBox)

In earlier versions this used to be:
Tid

In either case, this isn't much information. I think it would be useful if
toString was overloaded and returned a string with some sort of unique thread
ID, e.g.:

writeln(spawn(&test));  // Tid(0x0001)

This could make it easier to debug some types of threading problems without
having to use a debugger.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 22 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6989




11:42:52 PST ---
Hmm it looks like there isn't such a thing as a cross-platform
thread-identifier (at least not in Druntime).

Personally I like the idea of having named threads, where the name would be
stored in a Tid. So you could do things like:

spawn("workThread", &func, args);

where the first pointer argument is the function. It might help with debugging,
e.g. inspecting a Tid of a LinkTerminated exception could tell you which named
thread threw the exception.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6989




11:34:26 PDT ---

 Hmm it looks like there isn't such a thing as a cross-platform
 thread-identifier (at least not in Druntime).
Nevermind, there's actually m_addr, which is a uint on Windows and pthread_t on Posix (a pointer to _opaque_pthread_t). So I think core.thread.Thread should expose a getThreadID() function which returns m_addr, and then Tid can expose this function internally and also use it for toString(). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 25 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6989


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|Other                       |All
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com
         OS/Version|Windows                     |All



13:30:06 PDT ---
https://github.com/D-Programming-Language/phobos/pull/1582

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2013