Author: Armin Rigo <[email protected]>
Branch: gil-improvement
Changeset: r47788:bdeb78cfcd9f
Date: 2011-10-03 08:11 +0200
http://bitbucket.org/pypy/pypy/changeset/bdeb78cfcd9f/

Log:    Tweaks.

diff --git a/pypy/translator/c/src/thread_nt.h 
b/pypy/translator/c/src/thread_nt.h
--- a/pypy/translator/c/src/thread_nt.h
+++ b/pypy/translator/c/src/thread_nt.h
@@ -251,9 +251,9 @@
        normally specifying a timeout of INFINITE would be fine.  But the
        first and second operations are not done atomically, so there is a
        (small) risk that PulseEvent misses the WaitForSingleObject().
-       In this case the process will just sleep 1 millisecond. */
+       In this case the process will just sleep a few milliseconds. */
     LeaveCriticalSection(&mutex_gil);
-    WaitForSingleObject(&cond_gil, 1);
+    WaitForSingleObject(&cond_gil, 15);
     EnterCriticalSection(&mutex_gil);
 
     InterlockedDecrement(&pending_acquires);
diff --git a/pypy/translator/c/src/thread_pthread.h 
b/pypy/translator/c/src/thread_pthread.h
--- a/pypy/translator/c/src/thread_pthread.h
+++ b/pypy/translator/c/src/thread_pthread.h
@@ -536,10 +536,10 @@
         return 0;
     atomic_add(&pending_acquires, 1L);
     _debug_print("{");
+    ASSERT_STATUS(pthread_cond_signal(&cond_gil));
     ASSERT_STATUS(pthread_cond_wait(&cond_gil, &mutex_gil));
     _debug_print("}");
     atomic_add(&pending_acquires, -1L);
-    ASSERT_STATUS(pthread_cond_signal(&cond_gil));
     assert_has_the_gil();
     return 1;
 }
@@ -552,6 +552,7 @@
 #endif
     assert_has_the_gil();
     ASSERT_STATUS(pthread_mutex_unlock(&mutex_gil));
+    ASSERT_STATUS(pthread_cond_signal(&cond_gil));
 }
 
 void RPyGilAcquire(void)
@@ -564,7 +565,6 @@
     ASSERT_STATUS(pthread_mutex_lock(&mutex_gil));
     atomic_add(&pending_acquires, -1L);
     assert_has_the_gil();
-    ASSERT_STATUS(pthread_cond_signal(&cond_gil));
     _debug_print("RPyGilAcquire\n");
 }
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to