summaryrefslogtreecommitdiff
path: root/gcc/gthr-win32.h
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-10 18:06:34 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-10 18:06:34 +0000
commit533d0ceb28088c9b755731b0a9179dbc857b7e72 (patch)
treecb9b409978e20058c0a784dab93cc4c41074e52c /gcc/gthr-win32.h
parent24e3538db13430e484ce33946b6f600c82fcbf62 (diff)
downloadgcc-533d0ceb28088c9b755731b0a9179dbc857b7e72.tar.gz
2008-02-10 Danny Smith <dannysmith@users.sourceforge.net>
PR gcc/35063 * gthr-win32.h (__gthread_mutex_destroy_function): New function to CloseHandle after unlocking to prevent accumulation of handle count. 2008-02-10 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/35063 * io/unit.c (destroy_unit_mutex): New function that uses __gthread_mutex_destroy_function or pthread_mutex_destroy after unlocking and before free_mem for final closure of I/O unit. (delete_root): Use new function. (free_internal_unit): Likewise. (close_unit_1): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132217 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gthr-win32.h')
-rw-r--r--gcc/gthr-win32.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/gthr-win32.h b/gcc/gthr-win32.h
index 80b2b71c9e7..6a32c1a134c 100644
--- a/gcc/gthr-win32.h
+++ b/gcc/gthr-win32.h
@@ -359,6 +359,9 @@ typedef struct {
__gthread_recursive_mutex_init_function
#define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0}
+#define __GTHREAD_MUTEX_DESTROY_FUNCTION \
+ __gthread_mutex_destroy_function
+
#if __MINGW32_MAJOR_VERSION >= 1 || \
(__MINGW32_MAJOR_VERSION == 0 && __MINGW32_MINOR_VERSION > 2)
#define MINGW32_SUPPORTS_MT_EH 1
@@ -615,6 +618,12 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex)
mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
}
+static inline void
+__gthread_mutex_destroy_function (__gthread_mutex_t *mutex)
+{
+ CloseHandle ((HANDLE) mutex->sema);
+}
+
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{