1=begin 2 distributed Ruby --- dRuby Sample Server --- chasen server 3 Copyright (c) 1999-2001 Masatoshi SEKI 4=end 5 6=begin 7 How to play. 8 9 Terminal 1 10 | % ruby dhasen.rb 11 | druby://yourhost:7640 12 13 Terminal 2 14 | % ruby dhasenc.rb druby://yourhost:7640 15 16=end 17 18require 'drb/drb' 19require 'chasen' 20require 'thread' 21 22class Dhasen 23 include DRbUndumped 24 25 def initialize 26 @mutex = Mutex.new 27 end 28 29 def sparse(str, *arg) 30 @mutex.synchronize do 31 Chasen.getopt(*arg) 32 Chasen.sparse(str) 33 end 34 end 35end 36 37if __FILE__ == $0 38 DRb.start_service(nil, Dhasen.new) 39 puts DRb.uri 40 DRb.thread.join 41end 42 43