summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authorovidiu <ovidiu@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-29 00:37:49 +0000
committerovidiu <ovidiu@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-29 00:37:49 +0000
commit792564c15efbbc9e14b6fddaca94343c05110501 (patch)
treead4339b76e285ab19d6102f0c2f74853669cd952 /libobjc
parentcdcbf05fff850fbe954f9e15fbc1b4bb1e44abdc (diff)
downloadgcc-792564c15efbbc9e14b6fddaca94343c05110501.tar.gz
Fixed deallocation of a mutex in thr-single.c (patch from Chris Ball <cball@fmco.com>).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29701 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/ChangeLog4
-rw-r--r--libobjc/thr-posix.c14
2 files changed, 18 insertions, 0 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index b292188c690..8ded8934041 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,7 @@
+Thu Sep 23 07:19:12 1999 Chris Ball <cball@fmco.com>
+
+ * thr-posix.c (__objc_mutex_deallocate): made deallocate work.
+
Tue Sep 21 07:47:10 1999 Jeffrey A Law (law@cygnus.com)
* Makefile.in (gc.o, gc_gc.o): Do not pass -fgnu-runtime to
diff --git a/libobjc/thr-posix.c b/libobjc/thr-posix.c
index 5b40f711be8..a73c6277791 100644
--- a/libobjc/thr-posix.c
+++ b/libobjc/thr-posix.c
@@ -145,6 +145,20 @@ __objc_mutex_allocate(objc_mutex_t mutex)
int
__objc_mutex_deallocate(objc_mutex_t mutex)
{
+ int count = 1;
+
+ /*
+ * Posix Threads specifically require that the thread be unlocked for
+ * pthread_mutex_destroy to work.
+ */
+
+ while ( count )
+ {
+ if (( count = pthread_mutex_unlock((pthread_mutex_t *)mutex->backend))
+ < 0 )
+ return -1;
+ }
+
if (pthread_mutex_destroy((pthread_mutex_t *)mutex->backend))
return -1;