0

I want to run the startdrb method concurrently with the printstuff method on a Windows system. I messed around with Thread.new but the service starts and terminates after the thread completes.

How would this be written?

require 'drb'
require 'drb/ssl'

class TestDRB
  def dostuff
    ...
  end

  def startdrb
    begin
      config = {SSLCertName: [["CN","DRuby"]]}
      DRb.start_service("drbssl://127.0.0.1:9911", BHRBeacon.new, config)
    rescue Exception => e
      puts e.full_message
    end

  def printstuff  
    begin
      puts "this will run while Drb service is also running"
    end

TestDRB.new.startdrb
TestDRB.new.printstuff

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
zealias
  • 11
  • 1
  • Check out the Threads and Processes chapter of [Programming Ruby](http://ruby-doc.com/docs/ProgrammingRuby/) – Jared Beck Feb 09 '22 at 21:40
  • I believe the Process class is only for linux. as for Threads, I have tried Thread.new {TestDRB.new.startdrb} and it does not continue execution until there is an interrupt. So it is not concurrent – zealias Feb 09 '22 at 22:27

0 Answers0