Commits

Armin Rigo committed bdeb78c

Tweaks.

  • Participants
  • Parent commits b659bab
  • Branches gil-improvement

Comments (0)

Files changed (2)

File pypy/translator/c/src/thread_nt.h

        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);

File pypy/translator/c/src/thread_pthread.h

         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;
 }
 #endif
     assert_has_the_gil();
     ASSERT_STATUS(pthread_mutex_unlock(&mutex_gil));
+    ASSERT_STATUS(pthread_cond_signal(&cond_gil));
 }
 
 void RPyGilAcquire(void)
     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");
 }