PR libgomp/27254
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Jun 2006 03:07:54 +0000 (03:07 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Jun 2006 03:07:54 +0000 (03:07 +0000)
* io/unit.c (get_internal_unit): Initialize and lock thread mutex
for internal units.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114765 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/io/unit.c

index bd1aecb..8517cae 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-18  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       PR libgomp/27254
+       * io/unit.c (get_internal_unit): Initialize and lock thread mutex
+       for internal units.
+
 2006-06-06  Janne Blomqvist  <jb@gcc.gnu.org>
 
        * m4/in_pack.m4: Add TODO comment about detecting temporaries,
index 14438f8..0b7dee1 100644 (file)
@@ -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;