[#9331] initialize arguments — WATANABE Hirofumi <Hirofumi.Watanabe@...>
わたなべです.
10 messages
2000/03/01
[#9332] Re: initialize arguments
— WATANABE Tetsuya <tetsu@...>
2000/03/01
渡辺哲也です。
[#9377] Hash.new('') — WATANABE Tetsuya <tetsu@...>
渡辺哲也です。
11 messages
2000/03/06
[#9383] rb_call_super() — Yasushi Shoji <yashi@...>
やすしです。
10 messages
2000/03/06
[#9388] Re: rb_call_super()
— Kazuhiro HIWADA <hiwada@...>
2000/03/07
ひわだです。
[#9395] Re: rb_call_super()
— matz@... (Yukihiro Matsumoto)
2000/03/07
まつもと ゆきひろです
[#9398] Re: rb_call_super()
— Yasushi Shoji <yashi@...>
2000/03/07
やすしです。
[#9393] [PATCH] Symbol.new — nobu.nakada@...
なかだです。
13 messages
2000/03/07
[#9396] Re: [PATCH] Symbol.new
— matz@... (Yukihiro Matsumoto)
2000/03/07
まつもと ゆきひろです
[#9424] method_missing(Fixnum) — nobu.nakada@...
なかだです。
5 messages
2000/03/11
[#9430] [BUG] Process.kill :symbol, pid — Koji Arai <JCA02266@...>
新井です。
5 messages
2000/03/12
[#9445] thread.rb — m_seki@...
18 messages
2000/03/16
[#9446] Re: thread.rb
— matz@... (Yukihiro Matsumoto)
2000/03/17
[#9460] Re: thread.rb
— m_seki@...
2000/03/21
[#9462] Re: thread.rb
— matz@... (Yukihiro Matsumoto)
2000/03/21
まつもと ゆきひろです
[#11281] Re: thread.rb
— Masatoshi SEKI <m_seki@...>
2000/10/22
[#11282] Re: thread.rb
— Yasushi Shoji <yashi@...>
2000/10/22
At Mon, 23 Oct 2000 00:14:30 +0900,
[#11283] Re: thread.rb
— Masatoshi SEKI <m_seki@...>
2000/10/22
[#11284] Re: thread.rb
— Yasushi Shoji <yashi@...>
2000/10/22
At Mon, 23 Oct 2000 01:40:14 +0900,
[#11288] sync/async message passing model (was Re: Re: thread.rb)
— kjana@... (YANAGAWA Kazuhisa)
2000/10/23
In message <20001022171627N.yashi@yashi.com>
[#11291] Re: sync/async message passing model (was Re: Re: thread.rb)
— kjana@... (YANAGAWA Kazuhisa)
2000/10/24
追加,追加.
[#9447] ParseDate.parsedate( "2000-03-16T23:45:54+0900" ) — "NAKAMURA, Hiroshi" <nakahiro@...>
なひです.
10 messages
2000/03/17
[#9448] Re: ParseDate.parsedate( "2000-03-16T23:45:54+0900" )
— Tadayoshi Funaba <tadf@...>
2000/03/17
ふなばです。
[#9449] Re: ParseDate.parsedate( "2000-03-16T23:45:54+0900" )
— matz@... (Yukihiro Matsumoto)
2000/03/18
まつもと ゆきひろです
[#9451] Re: ParseDate.parsedate( "2000-03-16T23:45:54+0900" )
— Tadayoshi Funaba <tadf@...>
2000/03/18
ふなばです。
[#9473] Symbol#<=> — Koji Arai <JCA02266@...>
新井です。
12 messages
2000/03/23
[#9477] Re: Symbol#<=>
— matz@... (Yukihiro Matsumoto)
2000/03/24
まつもと ゆきひろです
[#9483] Re: Symbol#<=>
— Koji Arai <JCA02266@...>
2000/03/24
新井です。
[#9489] parsedate2 — Tadayoshi Funaba <tadf@...>
ふなばです。
7 messages
2000/03/25
[#9498] timeout しない timeout — ARIMA Yasuhiro <fit0298@...>
有馬です。
20 messages
2000/03/26
[#9506] Re: timeout しない timeout
— matz@... (Yukihiro Matsumoto)
2000/03/27
まつもと ゆきひろです
[#9509] Re: timeout しない timeout
— gotoken@... (GOTO Kentaro)
2000/03/27
In message "[ruby-dev:9506] Re: timeout しない timeout"
[#9511] Re: timeout しない timeout
— matz@... (Yukihiro Matsumoto)
2000/03/27
まつもと ゆきひろです
[#9512] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/27
有馬です。
[#9524] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/29
有馬です。
[#9525] Re: timeout しない timeout
— gotoken@... (GOTO Kentaro)
2000/03/29
ごとけんです
[#9526] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/29
有馬です。
[#9528] Re: timeout しない timeout
— gotoken@... (GOTO Kentaro)
2000/03/30
ごとけんです
[#9529] Re: timeout しない timeout
— ARIMA Yasuhiro <fit0298@...>
2000/03/30
有馬です。
[ruby-dev:9445] thread.rb
From:
m_seki@...
Date:
2000-03-16 00:05:16 UTC
List:
ruby-dev #9445
咳といいます。
1.4.3 のthread.rb を読んでました。
thread.rb に入っているスレッドの同期メカニズムなんですが、
(Queue, Mutex等)資源待ちのスレッドがだれかに exit された場合、
run や wakeup するときに失敗してしまうと思います。
require 'thread'
def reader(q)
Thread.new do
q.pop
end
end
q = Queue.new
t1 = reader(q)
t2 = reader(q)
t1.exit # まとめてにkillされたりTimeoutでkillされたり‥
q.push('hello')
→ ThreadError
ThreadGroupなどでまとめてkillできるようになると、
こういう局面がよくありそうな気がするのですが問題に
ならないでしょうか?
またMutex, Queueでは@waitingの先頭のスレッドだけを run/wakeup
しますが、@waiting中のすべてのスレッドをwakeupしないとまずい
局面がないですか。
起こされたスレッドが資源を獲得する前にこけちゃうとか。
# 考えなくていいのかな。よくわかんない。
以下 wakeup/run で ThreadError を rescue するパッチです。
QueueとMutexは試しましたがSizedQueue、状態変数はやってません。
# あっているか不安。
*** /usr/local/lib/ruby/1.4/thread.rb Mon Sep 13 13:32:35 1999
--- thread.rb Thu Mar 16 08:45:12 2000
***************
*** 63,72 ****
def unlock
return unless @locked
Thread.critical = true
- t = @waiting.shift
@locked = false
Thread.critical = false
- t.run if t
self
end
--- 63,76 ----
def unlock
return unless @locked
Thread.critical = true
@locked = false
+ begin
+ t = @waiting.shift
+ t.wakeup if t
+ rescue ThreadError
+ retry
+ end
Thread.critical = false
self
end
***************
*** 82,90 ****
def exclusive_unlock
return unless @locked
Thread.exclusive do
- t = @waiting.shift
@locked = false
! t.wakeup if t
yield
end
self
--- 86,98 ----
def exclusive_unlock
return unless @locked
Thread.exclusive do
@locked = false
! begin
! t = @waiting.shift
! t.wakeup if t
! rescue ThreadError
! retry
! end
yield
end
self
***************
*** 105,112 ****
end
def signal
! t = @waiters.shift
! t.run if t
end
def broadcast
--- 113,124 ----
end
def signal
! begin
! t = @waiters.shift
! t.run if t
! rescue ThreadError
! retry
! end
end
def broadcast
***************
*** 116,122 ****
@waiters.clear
end
for t in waiters0
! t.run
end
end
end
--- 128,137 ----
@waiters.clear
end
for t in waiters0
! begin
! t.run
! rescue ThreadError
! end
end
end
end
***************
*** 133,141 ****
def push(obj)
Thread.critical = true
@que.push obj
! t = @waiting.shift
Thread.critical = false
- t.run if t
end
alias enq push
--- 148,160 ----
def push(obj)
Thread.critical = true
@que.push obj
! begin
! t = @waiting.shift
! t.wakeup if t
! rescue ThreadError
! retry
! end
Thread.critical = false
end
alias enq push
***************
*** 201,208 ****
@max = max
Thread.critical = false
diff.times do
! t = @queue_wait.shift
! t.run if t
end
end
max
--- 220,231 ----
@max = max
Thread.critical = false
diff.times do
! begin
! t = @queue_wait.shift
! t.run if t
! rescue ThreadError
! retry
! end
end
end
max
***************
*** 221,228 ****
def pop(*args)
Thread.critical = true
if @que.length < @max
! t = @queue_wait.shift
! t.run if t
end
super
end
--- 244,255 ----
def pop(*args)
Thread.critical = true
if @que.length < @max
! begin
! t = @queue_wait.shift
! t.run if t
! rescue ThreadError
! retry
! end
end
super
end