The required_rubygems_version
constraint for this specification
A fallback is included because the original version of the specification API didn’t include that field, so some marshalled specs in the index have it set to nil
.
The required_rubygems_version
constraint for this specification
Called when the current thread exits. The scheduler is expected to implement this method in order to allow all waiting fibers to finalize their execution.
The suggested pattern is to implement the main event loop in the close
method.
Invoked by methods like Thread.join
, and by Mutex, to signify that current Fiber
is blocked until further notice (e.g. unblock
) or until timeout
has elapsed.
blocker
is what we are waiting on, informational only (for debugging and logging). There are no guarantee about its value.
Expected to return boolean, specifying whether the blocking operation was successful or not.
Invoked to wake up Fiber
previously blocked with block
(for example, Mutex#lock calls block
and Mutex#unlock calls unblock
). The scheduler should use the fiber
parameter to understand which fiber is unblocked.
blocker
is what was awaited for, but it is informational only (for debugging and logging), and it is not guaranteed to be the same value as the blocker
for block
.
Implementation of the Fiber.schedule
. The method is expected to immediately run the given block of code in a separate non-blocking fiber, and to return that Fiber
.
Minimal suggested implementation is:
def fiber(&block) fiber = Fiber.new(blocking: false, &block) fiber.resume fiber end
Like Enumerable#select
, but chains operation to be lazy-evaluated.
Returns the hash value of a given string. This is equivalent to Digest::Class.new(*parameters)
.digest(string), where extra parameters, if any, are passed through to the constructor and the string is passed to digest()
.
Returns the hex-encoded hash value of a given string. This is almost equivalent to Digest.hexencode
(Digest::Class.new(*parameters)
.digest(string)).
Returns the base64 encoded hash value of a given string. The return value is properly padded with ‘=’ and contains no line feeds.
Close this handle.
Calling close more than once will raise a Fiddle::DLError
exception.
Array
of the currently loaded libraries.
Allocates a C struct with the types
provided.
See Fiddle::Pointer.malloc
for memory management issues.
# Automatically freeing the pointer when the block is exited - recommended Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) do |pointer| ... end # Manually freeing but relying on the garbage collector otherwise pointer = Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) ... pointer.call_free # Relying on the garbage collector - may lead to unlimited memory allocated before freeing any, but safe pointer = Fiddle::Pointer.malloc(size, Fiddle::RUBY_FREE) ... # Only manually freeing pointer = Fiddle::Pointer.malloc(size) begin ... ensure Fiddle.free pointer end # No free function and no call to free - the native memory will leak if the pointer is garbage collected pointer = Fiddle::Pointer.malloc(size) ...
Allocate size
bytes of memory and associate it with an optional freefunc
.
If a block is supplied, the pointer will be yielded to the block instead of being returned, and the return value of the block will be returned. A freefunc
must be supplied if a block is.
If a freefunc
is supplied it will be called once, when the pointer is garbage collected or when the block is left if a block is supplied or when the user calls call_free
, whichever happens first. freefunc
must be an address pointing to a function or an instance of Fiddle::Function
.
Returns the names of all available ciphers in an array.
Return the hash value computed with name Digest
. name is either the long name or short name of a supported digest algorithm.
OpenSSL::Digest.digest("SHA256", "abc")
which is equivalent to:
OpenSSL::Digest.digest('SHA256', "abc")