Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #643: RegisterExternal.diff

File RegisterExternal.diff, 0.9 kB (added by CyberShadow, 1 year ago)

oops, meant to upload diff, not source

  • Thread.d

    old new  
    468468 
    469469 
    470470    /** 
     471     * Registers an "external" thread (a thread not created using Tango's API). 
     472     */ 
     473    static void registerExternalThread() 
     474    { 
     475        Thread t = new Thread(); 
     476 
     477        version(Win32) 
     478        { 
     479            t.m_addr  = GetCurrentThreadId(); 
     480            t.m_hndl  = GetCurrentThreadHandle(); 
     481        } 
     482        else 
     483        { 
     484            unimplemented(); 
     485        } 
     486 
     487        t.m_isDaemon = true; 
     488 
     489        t.m_main.bstack = getStackBottom(); 
     490        t.m_main.tstack = t.m_main.bstack; 
     491        Thread.add( &t.m_main ); 
     492        Thread.setThis( t ); 
     493        Thread.add(t); 
     494    } 
     495 
     496    /** 
    471497     * Starts the thread and invokes the function or delegate passed upon 
    472498     * construction. 
    473499     *