aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgfortran/io/async.c4
-rw-r--r--libgfortran/io/io.h4
-rw-r--r--libgfortran/io/transfer.c14
3 files changed, 12 insertions, 10 deletions
diff --git a/libgfortran/io/async.c b/libgfortran/io/async.c
index d216ace..247008c 100644
--- a/libgfortran/io/async.c
+++ b/libgfortran/io/async.c
@@ -117,13 +117,13 @@ async_io (void *arg)
{
case AIO_WRITE_DONE:
NOTE ("Finalizing write");
- st_write_done_worker (au->pdt);
+ st_write_done_worker (au->pdt, false);
UNLOCK (&au->io_lock);
break;
case AIO_READ_DONE:
NOTE ("Finalizing read");
- st_read_done_worker (au->pdt);
+ st_read_done_worker (au->pdt, false);
UNLOCK (&au->io_lock);
break;
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index e0007c6..3355bc2 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -1083,11 +1083,11 @@ default_precision_for_float (int kind)
#endif
extern void
-st_write_done_worker (st_parameter_dt *);
+st_write_done_worker (st_parameter_dt *, bool);
internal_proto (st_write_done_worker);
extern void
-st_read_done_worker (st_parameter_dt *);
+st_read_done_worker (st_parameter_dt *, bool);
internal_proto (st_read_done_worker);
extern void
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 71a9356..36e35b4 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -4337,7 +4337,7 @@ extern void st_read_done (st_parameter_dt *);
export_proto(st_read_done);
void
-st_read_done_worker (st_parameter_dt *dtp)
+st_read_done_worker (st_parameter_dt *dtp, bool unlock)
{
bool free_newunit = false;
finalize_transfer (dtp);
@@ -4367,7 +4367,8 @@ st_read_done_worker (st_parameter_dt *dtp)
free_format (dtp);
}
}
- unlock_unit (dtp->u.p.current_unit);
+ if (unlock)
+ unlock_unit (dtp->u.p.current_unit);
if (free_newunit)
{
/* Avoid inverse lock issues by placing after unlock_unit. */
@@ -4394,7 +4395,7 @@ st_read_done (st_parameter_dt *dtp)
unlock_unit (dtp->u.p.current_unit);
}
else
- st_read_done_worker (dtp); /* Calls unlock_unit. */
+ st_read_done_worker (dtp, true); /* Calls unlock_unit. */
}
library_end ();
@@ -4412,7 +4413,7 @@ st_write (st_parameter_dt *dtp)
void
-st_write_done_worker (st_parameter_dt *dtp)
+st_write_done_worker (st_parameter_dt *dtp, bool unlock)
{
bool free_newunit = false;
finalize_transfer (dtp);
@@ -4463,7 +4464,8 @@ st_write_done_worker (st_parameter_dt *dtp)
free_format (dtp);
}
}
- unlock_unit (dtp->u.p.current_unit);
+ if (unlock)
+ unlock_unit (dtp->u.p.current_unit);
if (free_newunit)
{
/* Avoid inverse lock issues by placing after unlock_unit. */
@@ -4496,7 +4498,7 @@ st_write_done (st_parameter_dt *dtp)
unlock_unit (dtp->u.p.current_unit);
}
else
- st_write_done_worker (dtp); /* Calls unlock_unit. */
+ st_write_done_worker (dtp, true); /* Calls unlock_unit. */
}
library_end ();