Check for mutex bugs.

This commit is contained in:
Ryan C. Gordon 2012-03-20 15:24:50 -04:00
parent e34e67ff68
commit f5923f5cea
1 changed files with 2 additions and 0 deletions

View File

@ -444,6 +444,8 @@ int __PHYSFS_platformGrabMutex(void *mutex)
void __PHYSFS_platformReleaseMutex(void *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->count == 0)