Class: DRb::ThreadObject (Ruby 2.7.2)
Description: Class : DRb::ThreadObject - Ruby 2.7.2

### Home Classes Methods

### In Files

- drb/drb.rb

### Parent

Object

### Methods

- ::new
- #_execute
- #alive?
- #kill
- #method_missing

### Included Modules

- MonitorMixin

### Class/Module Index

Quicksearch

- ACL
- ACL::ACLEntry
- ACL::ACLList
- DRb
- DRb::DRbArray
- DRb::DRbBadScheme
- DRb::DRbBadURI
- DRb::DRbConn
- DRb::DRbConnError
- DRb::DRbError
- DRb::DRbIdConv
- DRb::DRbIdConv
- DRb::DRbMessage
- DRb::DRbObject
- DRb::DRbObject
- DRb::DRbObservable
- DRb::DRbProtocol
- DRb::DRbRemoteError
- DRb::DRbSSLSocket
- DRb::DRbSSLSocket::SSLConfig
- DRb::DRbServerNotFound
- DRb::DRbTCPSocket
- DRb::DRbUNIXSocket
- DRb::DRbUndumped
- DRb::DRbUndumped
- DRb::DRbUnknown
- DRb::DRbUnknownError
- DRb::ExtServ
- DRb::ExtServManager
- DRb::GW
- DRb::GWIdConv
- DRb::Thread
- DRb::ThreadObject
- DRb::TimerIdConv
- DRb::TimerIdConv::TimerHolder2
- DRb::TimerIdConv::TimerHolder2::InvalidIndexError
- DRb::WeakIdConv
- DRb::WeakIdConv::WeakSet
- Object

No matching classes.

# DRb::ThreadObject

### Public Class Methods

new(&blk) click to toggle source

                   # File drb/drb.rb, line 1201
    def initialize(&blk)
      super()
      @wait_ev = new_cond
      @req_ev = new_cond
      @res_ev = new_cond
      @status = :wait
      @req = nil
      @res = nil
      @thread = Thread.new(self, &blk)
    end

### Public Instance Methods

_execute() click to toggle source

                   # File drb/drb.rb, line 1236
    def _execute()
      synchronize do
        @req_ev.wait_until { @status == :req }
        @res = yield(@req)
        @status = :res
        @res_ev.signal
      end
    end

alive?() click to toggle source

                   # File drb/drb.rb, line 1212
    def alive?
      @thread.alive?
    end

kill() click to toggle source

                   # File drb/drb.rb, line 1216
    def kill
      @thread.kill
      @thread.join
    end

method_missing(msg, *arg, &blk) click to toggle source

                   # File drb/drb.rb, line 1221
    def method_missing(msg, *arg, &blk)
      synchronize do
        @wait_ev.wait_until { @status == :wait }
        @req = [msg] + arg
        @status = :req
        @req_ev.broadcast
        @res_ev.wait_until { @status == :res }
        value = @res
        @req = @res = nil
        @status = :wait
        @wait_ev.broadcast
        return value
      end
    end