This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

pending_interrupt?

        # Thread.pending_interrupt?

(from ruby core)
---
    Thread.pending_interrupt?(error = nil) -> true/false

---

Returns whether or not the asynchronous queue is empty.

Since Thread::handle_interrupt can be used to defer asynchronous events,
this method can be used to determine if there are any deferred events.

If you find this method returns true, then you may finish `:never`
blocks.

For example, the following method processes deferred asynchronous events
immediately.

    def Thread.kick_interrupt_immediately
      Thread.handle_interrupt(Object => :immediate) {
        Thread.pass
      }
    end

If `error` is given, then check only for `error` type deferred events.

### Usage

    th = Thread.new{
      Thread.handle_interrupt(RuntimeError => :on_blocking){
        while true
          ...
          # reach safe point to invoke interrupt
          if Thread.pending_interrupt?
            Thread.handle_interrupt(Object => :immediate){}
          end
          ...
        end
      }
    }
    ...
    th.raise # stop thread

This example can also be written as the following, which you should use
to avoid asynchronous interrupts.

    flag = true
    th = Thread.new{
      Thread.handle_interrupt(RuntimeError => :on_blocking){
        while true
          ...
          # reach safe point to invoke interrupt
          break if flag == false
          ...
        end
      }
    }
    ...
    flag = false # stop thread


(from ruby core)
---
    target_thread.pending_interrupt?(error = nil) -> true/false

---

Returns whether or not the asynchronous queue is empty for the target
thread.

If `error` is given, then check only for `error` type deferred events.

See ::pending_interrupt? for more information.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.