summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io.c b/io.c
index 9103664412..bfafe636d8 100644
--- a/io.c
+++ b/io.c
@@ -3858,7 +3858,10 @@ finish_writeconv(rb_io_t *fptr, int noalloc)
res = rb_econv_convert(fptr->writeconv, NULL, NULL, &dp, de, 0);
while (dp-ds) {
retry:
- r = rb_write_internal(fptr->fd, ds, dp-ds);
+ if (fptr->write_lock && rb_mutex_owned_p(fptr->write_lock))
+ r = rb_write_internal2(fptr->fd, ds, dp-ds);
+ else
+ r = rb_write_internal(fptr->fd, ds, dp-ds);
if (r == dp-ds)
break;
if (0 <= r) {