www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15076] New: Get ID of current thread


          Issue ID: 15076
           Summary: Get ID of current thread
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

core.thread is missing a function to get the ID of the current thread. getpid
is insufficient, as even on POSIX it will return the same value for all

///////// test.d /////////
import core.thread;
import std.stdio;

void main()
    new Thread({

Essentially, it should be GetCurrentThreadId() on Windows and pthread_self() on
POSIX (same logic as for initializing Thread.m_addr).

Sep 16 2015