Changeset 374

Rainer Schuetze wrote:


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

_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta


_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to