From 9b7e4f4ff8d6daf711224a406dbf0368c314d1f6 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Mon, 19 Jun 2006 03:07:54 +0000 Subject: [PATCH] re PR libgomp/27254 (FAIL: libgomp.fortran/reduction6.f90) PR libgomp/27254 * io/unit.c (get_internal_unit): Initialize and lock thread mutex for internal units. From-SVN: r114765 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/unit.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index bd1aecbc32bd..8517cae1ee85 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2006-06-18 John David Anglin + + PR libgomp/27254 + * io/unit.c (get_internal_unit): Initialize and lock thread mutex + for internal units. + 2006-06-06 Janne Blomqvist * m4/in_pack.m4: Add TODO comment about detecting temporaries, diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index 14438f84c825..0b7dee10155f 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -376,6 +376,15 @@ get_internal_unit (st_parameter_dt *dtp) } memset (iunit, '\0', sizeof (gfc_unit)); +#ifdef __GTHREAD_MUTEX_INIT + { + __gthread_mutex_t tmp = __GTHREAD_MUTEX_INIT; + iunit->lock = tmp; + } +#else + __GTHREAD_MUTEX_INIT_FUNCTION (&iunit->lock); +#endif + __gthread_mutex_lock (&iunit->lock); iunit->recl = dtp->internal_unit_len;