aboutsummaryrefslogtreecommitdiffstats
path: root/core/serialthread.rb
diff options
context:
space:
mode:
authortoshi <toshi@03aab468-d3d2-4883-8b12-f661bbf03fa8>2012-07-28 04:06:13 +0000
committertoshi <toshi@03aab468-d3d2-4883-8b12-f661bbf03fa8>2012-07-28 04:06:13 +0000
commit440a95e949c42e77378bb87e2f64a5d46abc4720 (patch)
treec86c4dfbf23d773d43bc2ab206651a9c48763c0f /core/serialthread.rb
parentdf9102404549ab89e18aac162f14701b09d105dc (diff)
downloadmikutter-440a95e949c42e77378bb87e2f64a5d46abc4720.tar.gz
timeout()を呼び出してる箇所に、全て独自の例外クラスを定義してそれを発生させるように変更 refs #480
git-svn-id: svn://toshia.dip.jp/mikutter/branches/0.1.1@817 03aab468-d3d2-4883-8b12-f661bbf03fa8
Diffstat (limited to 'core/serialthread.rb')
-rw-r--r--core/serialthread.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/serialthread.rb b/core/serialthread.rb
index 1493ce08..25456b31 100644
--- a/core/serialthread.rb
+++ b/core/serialthread.rb
@@ -9,6 +9,7 @@ require 'timeout'
# 渡されたブロックを順番に実行するクラス
class SerialThreadGroup
+ QueueExpire = Class.new(TimeoutError)
# ブロックを同時に処理する個数。最大でこの数だけThreadが作られる
attr_accessor :max_threads
@@ -47,12 +48,12 @@ class SerialThreadGroup
def new_thread
@thread_pool << Thread.new{
begin
- while proc = timeout(1){ @queue.pop }
+ while proc = timeout(1, QueueExpire){ @queue.pop }
proc.call
break if flush
debugging_wait
Thread.pass end
- rescue TimeoutError => e
+ rescue QueueExpire => e
;
rescue Object => e
error e