sync=(p1)
public
Sets the “sync mode” to true or false. When
sync mode is true, all output is immediately
flushed to the underlying operating system and is not buffered internally.
Returns the new state. See also IO#fsync.
f = File.new("testfile")
f.sync = true
Show source
static VALUE
rb_io_set_sync(VALUE io, VALUE sync)
{
rb_io_t *fptr;
io = GetWriteIO(io);
GetOpenFile(io, fptr);
if (RTEST(sync)) {
fptr->mode |= FMODE_SYNC;
}
else {
fptr->mode &= ~FMODE_SYNC;
}
return sync;
}