aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index d466df9..dcae051 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1773,7 +1773,7 @@ find_file (const char *file, gfc_charlen_type file_len)
id = id_from_path (path);
#endif
- LOCK (&unit_lock);
+ RDLOCK (&unit_rwlock);
retry:
u = find_file0 (unit_root, FIND_FILE0_ARGS);
if (u != NULL)
@@ -1782,19 +1782,19 @@ retry:
if (! __gthread_mutex_trylock (&u->lock))
{
/* assert (u->closed == 0); */
- UNLOCK (&unit_lock);
+ RWUNLOCK (&unit_rwlock);
goto done;
}
inc_waiting_locked (u);
}
- UNLOCK (&unit_lock);
+ RWUNLOCK (&unit_rwlock);
if (u != NULL)
{
LOCK (&u->lock);
if (u->closed)
{
- LOCK (&unit_lock);
+ RDLOCK (&unit_rwlock);
UNLOCK (&u->lock);
if (predec_waiting_locked (u) == 0)
free (u);
@@ -1838,13 +1838,13 @@ flush_all_units (void)
gfc_unit *u;
int min_unit = 0;
- LOCK (&unit_lock);
+ WRLOCK (&unit_rwlock);
do
{
u = flush_all_units_1 (unit_root, min_unit);
if (u != NULL)
inc_waiting_locked (u);
- UNLOCK (&unit_lock);
+ RWUNLOCK (&unit_rwlock);
if (u == NULL)
return;
@@ -1855,13 +1855,13 @@ flush_all_units (void)
if (u->closed == 0)
{
sflush (u->s);
- LOCK (&unit_lock);
+ WRLOCK (&unit_rwlock);
UNLOCK (&u->lock);
(void) predec_waiting_locked (u);
}
else
{
- LOCK (&unit_lock);
+ WRLOCK (&unit_rwlock);
UNLOCK (&u->lock);
if (predec_waiting_locked (u) == 0)
free (u);