[dmd-beta] dmd 1.062 and 2.047 beta

Rainer Schuetze r.sagitario at gmx.de
Fri Aug 27 11:51:50 PDT 2010


Walter Bright wrote:
>
>
> Rainer Schuetze wrote:
>>
>>
>> thanks, it compiles now and the test cases seem to work. But trying 
>> it in the larger context where it happened first, I'm running into 
>> more problems with the latest phobos. But these are probably 
>> unrelated...
>>
>
> Sounds like we need better unit tests.

If you mean the way the unit tests currently work: yes, it seems in an 
ugly state of transition...

After fixing bug 4328, I could narrow the problems down to the polishing 
of std.thread (and involves attaching to threads that are not created 
from within D, so it is not easily covered by unit tests):

Index: thread.d
===================================================================
--- thread.d    (revision 373)
+++ thread.d    (working copy)
@@ -1903,7 +1903,6 @@
             thisThread.m_isRunning = true;
         }
         thisThread.m_isDaemon = true;
-        Thread.setThis( thisThread );
 
         version( OSX )
         {
@@ -1922,6 +1921,10 @@
             obj.m_tls = p[0 .. sz];
             memcpy( p, &_tls_beg, sz );
             // used gc_malloc so no need to free
+
+            if( t.m_addr == pthread_self() )
+                Thread.setThis( thisThread );
+
         }
         else version( Windows )
         {
@@ -1930,6 +1933,7 @@
                 auto pstart = cast(void*) &_tlsstart;
                 auto pend   = cast(void*) &_tlsend;
                 thisThread.m_tls = pstart[0 .. pend - pstart];
+                Thread.setThis( thisThread );
             }
             else
             {


can somebody apply this patch to druntime, please?

The original project also compiles fine now with the std.startsWith.

Rainer



More information about the dmd-beta mailing list