Ticket #389: drb_store_locking.diff
| File drb_store_locking.diff, 0.8 kB (added by BenStiglitz, 4 years ago) |
|---|
-
drb_server.rb
old new 5 5 6 6 require 'drb' 7 7 8 DRb.start_service('druby://127.0.0.1:9192', Hash.new) 8 session_hash = Hash.new 9 session_hash.instance_eval { @mutex = Mutex.new } 10 11 class <<session_hash 12 def []=(key, value) 13 @mutex.synchronize do 14 super(key, value) 15 end 16 end 17 18 def [](key) 19 @mutex.synchronize do 20 super(key) 21 end 22 end 23 24 def delete(key) 25 @mutex.synchronize do 26 super(key) 27 end 28 end 29 end 30 31 DRb.start_service('druby://127.0.0.1:9192', session_hash) 9 32 DRb.thread.join