changeset 239:403b07f873e1

Use a pointer for HMTX instead of a pthread_mutex_t struct.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 18 Feb 2003 20:09:04 +0000
parents 13d3de3f1e83
children afc0d5f5d74f
files dw.h gtk/dw.c
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Tue Feb 18 19:34:21 2003 +0000
+++ b/dw.h	Tue Feb 18 20:09:04 2003 +0000
@@ -466,7 +466,7 @@
 typedef char CHAR;
 typedef unsigned UINT;
 typedef int INT;
-typedef pthread_mutex_t HMTX;
+typedef pthread_mutex_t *HMTX;
 typedef struct _dw_unix_event {
 	pthread_mutex_t mutex;
 	pthread_cond_t event;
--- a/gtk/dw.c	Tue Feb 18 19:34:21 2003 +0000
+++ b/gtk/dw.c	Tue Feb 18 20:09:04 2003 +0000
@@ -5257,9 +5257,9 @@
  */
 HMTX dw_mutex_new(void)
 {
-	HMTX mutex;
-
-	pthread_mutex_init(&mutex, NULL);
+	HMTX mutex = malloc(sizeof(pthread_mutex_t));
+
+	pthread_mutex_init(mutex, NULL);
 	return mutex;
 }
 
@@ -5270,7 +5270,11 @@
  */
 void dw_mutex_close(HMTX mutex)
 {
-	pthread_mutex_destroy(&mutex);
+	if(mutex)
+	{
+		pthread_mutex_destroy(mutex);
+		free(mutex);
+	}
 }
 
 /*
@@ -5286,7 +5290,7 @@
 	if(pthread_self() == _dw_thread)
 		gdk_threads_leave();
 
-	pthread_mutex_lock(&mutex);
+	pthread_mutex_lock(mutex);
 
 	/* And of course relock it when we have acquired the mutext */
 	if(pthread_self() == _dw_thread)
@@ -5300,7 +5304,7 @@
  */
 void dw_mutex_unlock(HMTX mutex)
 {
-	pthread_mutex_unlock(&mutex);
+	pthread_mutex_unlock(mutex);
 }
 
 /*