summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/glapi/glthread.h12
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/hash.c3
-rw-r--r--src/mesa/main/texobj.c5
4 files changed, 20 insertions, 4 deletions
diff --git a/src/mesa/glapi/glthread.h b/src/mesa/glapi/glthread.h
index 1b2a648da81..5281a3e7030 100644
--- a/src/mesa/glapi/glthread.h
+++ b/src/mesa/glapi/glthread.h
@@ -1,4 +1,4 @@
-/* $Id: glthread.h,v 1.11 2002/03/07 21:50:41 brianp Exp $ */
+/* $Id: glthread.h,v 1.12 2002/12/12 13:03:15 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -101,6 +101,9 @@ typedef pthread_mutex_t _glthread_Mutex;
#define _glthread_INIT_MUTEX(name) \
pthread_mutex_init(&(name), NULL)
+#define _glthread_DESTROY_MUTEX(name) \
+ pthread_mutex_destroy(&(name))
+
#define _glthread_LOCK_MUTEX(name) \
(void) pthread_mutex_lock(&(name))
@@ -134,6 +137,7 @@ typedef mutex_t _glthread_Mutex;
/* XXX need to really implement mutex-related macros */
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
#define _glthread_INIT_MUTEX(name) (void) name
+#define _glthread_DESTROY_MUTEX(name) (void) name
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
@@ -162,6 +166,7 @@ typedef CRITICAL_SECTION _glthread_Mutex;
/* XXX need to really implement mutex-related macros */
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
#define _glthread_INIT_MUTEX(name) (void) name
+#define _glthread_DESTROY_MUTEX(name) (void) name
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
@@ -197,6 +202,9 @@ typedef xmutex_rec _glthread_Mutex;
#define _glthread_INIT_MUTEX(name) \
xmutex_init(&(name))
+#define _glthread_DESTROY_MUTEX(name) \
+ xmutex_clear(&(name))
+
#define _glthread_LOCK_MUTEX(name) \
(void) xmutex_lock(&(name))
@@ -254,6 +262,8 @@ typedef GLuint _glthread_Mutex;
#define _glthread_INIT_MUTEX(name) (void) name
+#define _glthread_DESTROY_MUTEX(name) (void) name
+
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 4656f25a701..2784fa82bd8 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.189 2002/11/19 15:25:00 brianp Exp $ */
+/* $Id: context.c,v 1.190 2002/12/12 13:03:15 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -746,6 +746,8 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
_mesa_DeleteHashTable(ss->VertexPrograms);
#endif
+ _glthread_DESTROY_MUTEX(ss->Mutex);
+
FREE(ss);
}
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 71df0cbf5bf..b22ee2551ab 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -1,4 +1,4 @@
-/* $Id: hash.c,v 1.14 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: hash.c,v 1.15 2002/12/12 13:03:15 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -94,6 +94,7 @@ void _mesa_DeleteHashTable(struct _mesa_HashTable *table)
entry = next;
}
}
+ _glthread_DESTROY_MUTEX(table->Mutex);
FREE(table);
}
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 93ae40ac745..f24a0b03de7 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.62 2002/10/24 23:57:21 brianp Exp $ */
+/* $Id: texobj.c,v 1.63 2002/12/12 13:03:15 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -164,6 +164,9 @@ void _mesa_free_texture_object( struct gl_shared_state *shared,
}
}
+ /* destroy the mutex -- it may have allocated memory (eg on bsd) */
+ _glthread_DESTROY_MUTEX(t->Mutex);
+
/* free this object */
FREE( t );
}