changeset 11853:b5805b819ff9

reviewed the locking codes, a mutex should be unlocked before destroying it
author alex
date Sun, 25 Jan 2004 20:29:31 +0000
parents 0bbdbc75532f
children 338515bd77e8
files loader/win32.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/loader/win32.c	Sun Jan 25 20:03:47 2004 +0000
+++ b/loader/win32.c	Sun Jan 25 20:29:31 2004 +0000
@@ -1379,6 +1379,8 @@
 	cs->locked=0;
 	pthread_mutex_unlock(&(cs->mutex));
     }
+    else
+	printf("Win32 Warning: Unlocking unlocked Critical Section %p!!\n", c);
     return;
 }
 
@@ -1394,6 +1396,18 @@
     //    struct CRITSECT* cs=(struct CRITSECT*)c;
     dbgprintf("DeleteCriticalSection(0x%x)\n",c);
 
+    if (!cs)
+    {
+	printf("Win32 Warning: Deleting uninitialized Critical Section %p!!\n", c);
+	return;
+    }
+    
+    if (cs->locked)
+    {
+	printf("Win32 Warning: Deleting unlocked Critical Section %p!!\n", c);
+	pthread_mutex_unlock(&(cs->mutex));
+    }
+
 #ifndef GARBAGE
     pthread_mutex_destroy(&(cs->mutex));
     // released by GarbageCollector in my_relase otherwise