Backport #5665 ยป 0001-io.c-rb_io_fsync-rb_io_fdatasync-release-GVL.patch
io.c | ||
---|---|---|
}
|
||
#ifdef HAVE_FSYNC
|
||
static VALUE nogvl_fsync(void *ptr)
|
||
{
|
||
rb_io_t *fptr = ptr;
|
||
return (int)fsync(fptr->fd);
|
||
}
|
||
/*
|
||
* call-seq:
|
||
* ios.fsync -> 0 or nil
|
||
... | ... | |
if (io_fflush(fptr) < 0)
|
||
rb_sys_fail(0);
|
||
#ifndef _WIN32 /* already called in io_fflush() */
|
||
if (fsync(fptr->fd) < 0)
|
||
if ((int)rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd) < 0)
|
||
rb_sys_fail_path(fptr->pathv);
|
||
#endif
|
||
return INT2FIX(0);
|
||
... | ... | |
#endif
|
||
#ifdef HAVE_FDATASYNC
|
||
static VALUE nogvl_fdatasync(void *ptr)
|
||
{
|
||
rb_io_t *fptr = ptr;
|
||
return (int)fdatasync(fptr->fd);
|
||
}
|
||
/*
|
||
* call-seq:
|
||
* ios.fdatasync -> 0 or nil
|
||
... | ... | |
if (io_fflush(fptr) < 0)
|
||
rb_sys_fail(0);
|
||
if (fdatasync(fptr->fd) == 0)
|
||
if ((int)rb_thread_io_blocking_region(nogvl_fdatasync, fptr, fptr->fd) == 0)
|
||
return INT2FIX(0);
|
||
/* fall back */
|