作者godfat (godfat 真常)
看板Ruby
标题Re: [问题] thread + socket?
时间Thu Jul 5 09:49:55 2007
※ 引述《godfat (godfat 真常)》之铭言:
: 可是我只是插入一段空的 synchronize 耶?像是这样:
: class Server
: include MonitorMixin
: def alive?
: synchronize{}
: @alive
: end
: end
後来的解决办法就是回到 mutex
require 'thread'
class Server
def initialize
@mutex = Mutex.new
# ... rest of codes
end
def alive?
@mutex.synchronize{
@alive
}
end
end
可是我真不懂 monitor 是出什麽问题了﹍
--
Hear me exalted spirits. Hear me, be you gods or devils, ye who hold
dominion here:
I am a wizard without a home. I am a wonderer seeking refuge.
Sacrifice
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.218.90.242