summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-01 10:46:31 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-01 10:46:31 +0000
commit1cd3a3444bb9ab510b126cb58982588287e61b74 (patch)
tree0a496ad8673e22a94b319a53eee147bd5fcac42a
parenta2bdd6432ca7a2e629c7bbdef12ae5b75a8da5c2 (diff)
downloadgcc-1cd3a3444bb9ab510b126cb58982588287e61b74.tar.gz
gcc:
2008-03-01 Janne Blomqvist <jb@gcc.gnu.org> PR gcc/35063 * gthr.h: Add __gthread_mutex_destroy as a function that must be implemented. * gthr-vxworks.h (__gthread_mutex_destroy): Null implementation. * gthr-single.h (__gthread_mutex_destroy): Likewise. * gthr-rtems.h (__gthread_mutex_destroy): Likewise. * gthr-mipssde.h (__gthread_mutex_destroy): Likewise. * gthr-nks.h (__gthread_mutex_destroy): Likewise. * gthr-solaris.h (__gthread_mutex_destroy): Call mutex_destroy. * gthr-win32.h (__GTHREAD_MUTEX_DESTROY_FUNCTION): Remove. (__gthread_mutex_destroy_function): Rename to __gthread_mutex_destroy. * gthr-dce.h (__gthread_mutex_destroy): Call pthread_mutex_destroy. * gthr-tpf.h (__gthread_mutex_destroy): Likewise. * gthr-posix.h (__gthread_mutex_destroy): Likewise. * gthr-posix95.h (__gthread_mutex_destroy): Likewise. libgfortran: 2008-03-01 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/35063 * io/unit.c (destroy_unit_mutex): Call __gthread_mutex_destroy instead of macro kludge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132800 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/gthr-dce.h10
-rw-r--r--gcc/gthr-mipssde.h6
-rw-r--r--gcc/gthr-nks.h6
-rw-r--r--gcc/gthr-posix.h11
-rw-r--r--gcc/gthr-posix95.h12
-rw-r--r--gcc/gthr-rtems.h6
-rw-r--r--gcc/gthr-single.h6
-rw-r--r--gcc/gthr-solaris.h9
-rw-r--r--gcc/gthr-tpf.h10
-rw-r--r--gcc/gthr-vxworks.h6
-rw-r--r--gcc/gthr-win32.h5
-rw-r--r--gcc/gthr.h2
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/unit.c8
15 files changed, 111 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96a538c48f8..2455b177e15 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2008-03-01 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR gcc/35063
+ * gthr.h: Add __gthread_mutex_destroy as a function that must be
+ implemented.
+ * gthr-vxworks.h (__gthread_mutex_destroy): Null implementation.
+ * gthr-single.h (__gthread_mutex_destroy): Likewise.
+ * gthr-rtems.h (__gthread_mutex_destroy): Likewise.
+ * gthr-mipssde.h (__gthread_mutex_destroy): Likewise.
+ * gthr-nks.h (__gthread_mutex_destroy): Likewise.
+ * gthr-solaris.h (__gthread_mutex_destroy): Call mutex_destroy.
+ * gthr-win32.h (__GTHREAD_MUTEX_DESTROY_FUNCTION): Remove.
+ (__gthread_mutex_destroy_function): Rename to
+ __gthread_mutex_destroy.
+ * gthr-dce.h (__gthread_mutex_destroy): Call
+ pthread_mutex_destroy.
+ * gthr-tpf.h (__gthread_mutex_destroy): Likewise.
+ * gthr-posix.h (__gthread_mutex_destroy): Likewise.
+ * gthr-posix95.h (__gthread_mutex_destroy): Likewise.
+
2008-03-01 Alexandre Oliva <aoliva@redhat.com>
* df-scan.c (df_ref_chain_change_bb): Simplify.
diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h
index d876c659e06..e95a4e5c87d 100644
--- a/gcc/gthr-dce.h
+++ b/gcc/gthr-dce.h
@@ -71,6 +71,7 @@ __gthrw(pthread_getspecific)
__gthrw(pthread_setspecific)
__gthrw(pthread_create)
__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
__gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
__gthrw(pthread_mutex_unlock)
@@ -475,6 +476,15 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex)
}
static inline int
+__gthread_mutx_destroy (__gthread_mutex_t *mutex)
+{
+ if (__gthread_active_p ())
+ return __gthrw_(pthread_mutex_destroy) (mutex);
+ else
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
diff --git a/gcc/gthr-mipssde.h b/gcc/gthr-mipssde.h
index 28111e3929e..b8cf24ebc75 100644
--- a/gcc/gthr-mipssde.h
+++ b/gcc/gthr-mipssde.h
@@ -135,6 +135,12 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
+{
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
diff --git a/gcc/gthr-nks.h b/gcc/gthr-nks.h
index 2c2b3e973a5..14027e0871b 100644
--- a/gcc/gthr-nks.h
+++ b/gcc/gthr-nks.h
@@ -342,6 +342,12 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
+{
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
return NXLock (*mutex);
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
index ad6822e26ad..b0c9ebbc370 100644
--- a/gcc/gthr-posix.h
+++ b/gcc/gthr-posix.h
@@ -94,6 +94,7 @@ __gthrw3(pthread_mutex_lock)
__gthrw3(pthread_mutex_trylock)
__gthrw3(pthread_mutex_unlock)
__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
__gthrw3(pthread_cond_broadcast)
__gthrw3(pthread_cond_wait)
#else
@@ -106,6 +107,7 @@ __gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
__gthrw(pthread_mutex_unlock)
__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
__gthrw(pthread_cond_broadcast)
__gthrw(pthread_cond_wait)
#endif
@@ -677,6 +679,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *mutex)
+{
+ if (__gthread_active_p ())
+ return __gthrw_(pthread_mutex_destroy) (mutex);
+ else
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
diff --git a/gcc/gthr-posix95.h b/gcc/gthr-posix95.h
index eb54c925f6f..d993c1309af 100644
--- a/gcc/gthr-posix95.h
+++ b/gcc/gthr-posix95.h
@@ -80,13 +80,14 @@ __gthrw(pthread_create)
__gthrw(pthread_cancel)
__gthrw(pthread_self)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
__gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
__gthrw(pthread_mutex_unlock)
__gthrw(pthread_mutexattr_init)
__gthrw(pthread_mutexattr_destroy)
-__gthrw(pthread_mutex_init)
__gthrw(pthread_cond_broadcast)
__gthrw(pthread_cond_wait)
@@ -640,6 +641,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *mutex)
+{
+ if (__gthread_active_p ())
+ return __gthrw_(pthread_mutex_destroy) (mutex);
+ else
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
diff --git a/gcc/gthr-rtems.h b/gcc/gthr-rtems.h
index f678abac646..425d7dee0e9 100644
--- a/gcc/gthr-rtems.h
+++ b/gcc/gthr-rtems.h
@@ -111,6 +111,12 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
+{
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
return rtems_gxx_mutex_lock (mutex);
diff --git a/gcc/gthr-single.h b/gcc/gthr-single.h
index c3a903deb65..7dd1f5471cf 100644
--- a/gcc/gthr-single.h
+++ b/gcc/gthr-single.h
@@ -216,6 +216,12 @@ __gthread_active_p (void)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
+{
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t * UNUSED(mutex))
{
return 0;
diff --git a/gcc/gthr-solaris.h b/gcc/gthr-solaris.h
index 5665ecdb4b6..a726bfa1fd9 100644
--- a/gcc/gthr-solaris.h
+++ b/gcc/gthr-solaris.h
@@ -462,6 +462,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
+{
+ if (__gthread_active_p ())
+ return __gthrw_(mutex_destroy) (mutex);
+ else
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
diff --git a/gcc/gthr-tpf.h b/gcc/gthr-tpf.h
index b63d527e886..fd80bd49df3 100644
--- a/gcc/gthr-tpf.h
+++ b/gcc/gthr-tpf.h
@@ -92,6 +92,7 @@ __gthrw(pthread_mutexattr_init)
__gthrw(pthread_mutexattr_settype)
__gthrw(pthread_mutexattr_destroy)
__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
static inline int
__gthread_active_p (void)
@@ -145,6 +146,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *mutex)
+{
+ if (__tpf_pthread_active ())
+ return __gthrw_(pthread_mutex_destroy) (mutex);
+ else
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
if (__tpf_pthread_active ())
diff --git a/gcc/gthr-vxworks.h b/gcc/gthr-vxworks.h
index c11d3a20cab..ba813140d76 100644
--- a/gcc/gthr-vxworks.h
+++ b/gcc/gthr-vxworks.h
@@ -61,6 +61,12 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex)
}
static inline int
+__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
+{
+ return 0;
+}
+
+static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
return semTake (*mutex, WAIT_FOREVER);
diff --git a/gcc/gthr-win32.h b/gcc/gthr-win32.h
index 6a32c1a134c..b75c8654a08 100644
--- a/gcc/gthr-win32.h
+++ b/gcc/gthr-win32.h
@@ -359,9 +359,6 @@ 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
@@ -619,7 +616,7 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex)
}
static inline void
-__gthread_mutex_destroy_function (__gthread_mutex_t *mutex)
+__gthread_mutex_destroy (__gthread_mutex_t *mutex)
{
CloseHandle ((HANDLE) mutex->sema);
}
diff --git a/gcc/gthr.h b/gcc/gthr.h
index a37b9119922..a145ef1a9de 100644
--- a/gcc/gthr.h
+++ b/gcc/gthr.h
@@ -73,6 +73,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
void *__gthread_getspecific (__gthread_key_t key)
int __gthread_setspecific (__gthread_key_t key, const void *ptr)
+ int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
+
int __gthread_mutex_lock (__gthread_mutex_t *mutex);
int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 210a37274f4..8ed3624e01d 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-01 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/35063
+ * io/unit.c (destroy_unit_mutex): Call __gthread_mutex_destroy
+ instead of macro kludge.
+
2008-02-25 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/29549
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index 2ec776f0d68..a54061d2f84 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -209,13 +209,7 @@ insert_unit (int n)
static void
destroy_unit_mutex (gfc_unit * u)
{
-#ifdef __GTHREAD_MUTEX_DESTROY_FUNCTION
- __GTHREAD_MUTEX_DESTROY_FUNCTION (&u->lock);
-#else
-#ifdef __CYGWIN__
- pthread_mutex_destroy (&u->lock);
-#endif
-#endif
+ __gthread_mutex_destroy (&u->lock);
free_mem (u);
}