Sfoglia il codice sorgente

Check for mutex bugs.

Ryan C. Gordon 14 anni fa
parent
commit
f5923f5cea
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      src/platform_posix.c

+ 2 - 0
src/platform_posix.c

@@ -444,6 +444,8 @@ int __PHYSFS_platformGrabMutex(void *mutex)
 void __PHYSFS_platformReleaseMutex(void *mutex)
 void __PHYSFS_platformReleaseMutex(void *mutex)
 {
 {
     PthreadMutex *m = (PthreadMutex *) mutex;
     PthreadMutex *m = (PthreadMutex *) mutex;
+    assert(m->owner == pthread_self());  /* catch programming errors. */
+    assert(m->count > 0);  /* catch programming errors. */
     if (m->owner == pthread_self())
     if (m->owner == pthread_self())
     {
     {
         if (--m->count == 0)
         if (--m->count == 0)