Returns true
if the file is a block device, false
if it isn’t or if the operating system doesn’t support this feature.
File.stat("testfile").blockdev? #=> false File.stat("/dev/hda1").blockdev? #=> true
If the buffer is locked, meaning it is inside locked
block execution. Locked buffer can’t be resized or freed, and another lock can’t be acquired on it.
Locking is not thread safe, but is a semantic used to ensure buffers don’t move while being used by a system call.
buffer.locked do buffer.write(io) # theoretical system call interface end
Allows to process a buffer in exclusive way, for concurrency-safety. While the block is performed, the buffer is considered locked, and no other code can enter the lock. Also, locked buffer can’t be changed with resize
or free
.
buffer = IO::Buffer.new(4) buffer.locked? #=> false Fiber.schedule do buffer.locked do buffer.write(io) # theoretical system call interface end end Fiber.schedule do # in `locked': Buffer already locked! (IO::Buffer::LockedError) buffer.locked do buffer.set_string(...) end end
The following operations acquire a lock: resize
, free
.
Locking is not thread safe. It is designed as a safety net around non-blocking system calls. You can only share a buffer between threads with appropriate synchronisation techniques.
A set of tasks to prepare the file in order to parse it
Sends a LOCK request to the path
and gets a response, as an HTTPResponse
object.
Sends a UNLOCK request to the path
and gets a response, as an HTTPResponse
object.
Inserts switch
at the head of the list, and associates short, long and negated long options. Arguments are:
switch
OptionParser::Switch
instance to be inserted.
short_opts
List
of short style options.
long_opts
List
of long style options.
nolong_opts
List
of long style options with “no-” prefix.
prepend(switch, short_opts, long_opts, nolong_opts)
Opens a block for grouping objects to be pretty printed.
Arguments:
indent
- noop argument. Present for compatibility.
open_obj
- text appended before the &blok. Default is ”
close_obj
- text appended after the &blok. Default is ”
open_width
- noop argument. Present for compatibility.
close_width
- noop argument. Present for compatibility.
for debug