http://d.puremagic.com/issues/show_bug.cgi?id=3054





--- Comment #1 from david <dav...@126.com>  2009-06-14 07:52:45 PDT ---
the core.thread gets two problem:

1.
t = new Thread(
(){
while(true){}
}
);

delete t; 

The last line should stuck there, because the thread is still running.

A possible solution is add a join in the dtor. It's quite fair your code stuck
there if the thread is still running.


Another problem is thread_scanAll.

extern (C) void thread_scanAll( scanAllThreadsFn scan, void* curStackTop = null
)     


Notice thread_scanAll may happen before the m_tls is set.

so the for loop:

    for( Thread t = Thread.sm_tbeg; t; t = t.next )                       
    {                                                                     
+++        if (t.tlsvalid)                                                   
            scan( &t.m_tls[0], &t.m_tls[0] + t.m_tls.length );              

        version( Windows )                                                
        {                                                                 
            scan( &t.m_reg[0], &t.m_reg[0] + t.m_reg.length );            
        }                                                                 
    }                                                                     

add a tlsvalid bool var to the thread.

in : extern (Windows) uint thread_entryPoint( void* arg )            



obj.m_tls = pstart[0 .. pend - pstart];        
+++obj.tlsvalid = true;                           

POSIX version possiblly need some equivalent fixes either.

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

Reply via email to