Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Mutex
.
Closes the queue. A closed queue cannot be re-opened.
After the call to close completes, the following are true:
closed?
will return true
close
will be ignored.
calling enq/push/<< will return nil.
when empty?
is false, calling deq/pop/shift will return an object from the queue as usual.
ClosedQueueError
is inherited from StopIteration
, so that you can break loop block.
Example: q = Queue.new Thread.new{ while e = q.deq # wait for nil to break loop # ... end } q.close
Returns true
if the queue is closed.
Retrieves data from the queue.
If the queue is empty, the calling thread is suspended until data is pushed onto the queue. If non_block
is true, the thread isn’t suspended, and an exception is raised.
Returns true
if the queue is empty.
Removes all objects from the queue.
Similar to Queue#close
.
The difference is behavior with waiting enqueuing threads.
If there are waiting enqueuing threads, they are interrupted by raising ClosedQueueError(‘queue closed’).
Retrieves data from the queue.
If the queue is empty, the calling thread is suspended until data is pushed onto the queue. If non_block
is true, the thread isn’t suspended, and an exception is raised.
Removes all objects from the queue.
Resets the digest to the initial state and returns self.
This method is overridden by each implementation subclass.
If none is given, returns the resulting hash value of the digest in a base64 encoded form, keeping the digest’s state.
If a string
is given, returns the hash value for the given string
in a base64 encoded form, resetting the digest to the initial state before and after the process.
In either case, the return value is properly padded with ‘=’ and contains no line feeds.
Returns the resulting hash value and resets the digest to the initial state.
Creates a global method from the given C signature
.
The Fiddle::CompositeHandler
instance
Will raise an error if no handlers are open.
Reads a one-character string from the stream. Raises an EOFError
at end of file.
Closes the SSLSocket and flushes any unwritten data.
::seed
is equivalent to ::add where entropy
is length of str
.
Start streaming using encoding
Clears the GC
profiler data.
Generate a Document Base URI
element as a String.
href
can either by a string, giving the base URL for the HREF attribute, or it can be a has of the element’s attributes.
The passed-in no-argument block is ignored.
base("http://www.example.com/cgi") # => "<BASE HREF=\"http://www.example.com/cgi\">"
Generate a reset button Input element, as a String.
This resets the values on a form to their initial values. value
is the text displayed on the button. name
is the name of this button.
Alternatively, the attributes can be specified as a hash.
reset # <INPUT TYPE="reset"> reset("reset") # <INPUT TYPE="reset" VALUE="reset"> reset("VALUE" => "reset", "ID" => "foo") # <INPUT TYPE="reset" VALUE="reset" ID="foo">