ライブラリ
クラス
-
DRb
:: DRbServer (12) - Exception (12)
- Fiber (24)
- IO (24)
-
IRB
:: Context (12) - Monitor (42)
- Mutex (8)
-
Net
:: IMAP (48) -
Net
:: IMAP :: ThreadMember (24) -
Rake
:: Application (12) - Thread (441)
-
Thread
:: Backtrace :: Location (84) -
Thread
:: ConditionVariable (36) -
Thread
:: Mutex (70) -
Thread
:: Queue (152) -
Thread
:: SizedQueue (130) - ThreadGroup (48)
- ThreadsWait (42)
- Tracer (12)
-
WEBrick
:: GenericServer (12)
モジュール
- Kernel (16)
- MonitorMixin (12)
-
Sync
_ m (24)
キーワード
- << (24)
- [] (12)
- []= (12)
-
abort
_ on _ exception (12) -
abort
_ on _ exception= (12) -
absolute
_ path (12) - add (12)
-
add
_ trace _ func (12) - alive? (12)
-
all
_ waits (6) - backtrace (12)
-
backtrace
_ locations (36) -
base
_ label (12) - broadcast (12)
- children (12)
- clear (12)
-
client
_ thread (12) -
client
_ thread= (12) - close (20)
- closed? (10)
- deq (24)
- empty? (26)
- enclose (12)
- enclosed? (12)
- enq (24)
- enter (12)
- eof (12)
- eof? (12)
- exit (24)
- fetch (8)
- finished? (6)
-
get
_ thread _ no (12) - group (12)
-
ignore
_ deadlock (4) -
ignore
_ deadlock= (4) - inspect (24)
- join (30)
-
join
_ nowait (6) - key? (12)
- keys (12)
- kill (12)
- label (12)
- length (20)
- lineno (12)
- list (12)
- lock (12)
- locked? (10)
- max (12)
- max= (12)
-
mon
_ enter (18) -
mon
_ exit (6) - name (10)
- name= (10)
-
next
_ wait (6) -
num
_ waiting (12) - owned? (12)
- path (12)
-
pending
_ interrupt? (12) - pop (24)
- priority (12)
- priority= (12)
- push (24)
- raise (12)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) - resume (12)
- run (12)
-
safe
_ level (7) - seqno (12)
-
set
_ trace _ func (12) - shift (24)
- signal (12)
- size (20)
- sleep (12)
- status (12)
- stop? (12)
-
sync
_ ex _ locker (6) -
sync
_ ex _ locker= (6) -
sync
_ upgrade _ waiting (6) -
sync
_ waiting (6) - synchronize (10)
- terminate (12)
-
thread
_ variable? (12) -
thread
_ variable _ get (12) -
thread
_ variable _ set (12) - threads (6)
- timeout (16)
-
to
_ s (20) - tokens (12)
- transfer (12)
-
try
_ lock (10) -
uid
_ thread (12) - unlock (12)
- value (12)
- wait (12)
-
wait
_ for _ cond (6) - wakeup (12)
検索結果
先頭5件
-
Thread
# abort _ on _ exception -> bool (9053.0) -
真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。
...。false の場合、あるスレッドで起こった例
外は、Thread#join などで検出されない限りそのスレッ
ドだけをなにも警告を出さずに終了させます。
デフォルトは偽です。c:Thread#exceptionを参照してください。
@param newstate 自身を......実行中に例外発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.abort_on_exception # => false
thread.abort_on_exception = true
thread.abort_on_exception # => true
//}... -
Thread
# abort _ on _ exception=(newstate) (9053.0) -
真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。
...。false の場合、あるスレッドで起こった例
外は、Thread#join などで検出されない限りそのスレッ
ドだけをなにも警告を出さずに終了させます。
デフォルトは偽です。c:Thread#exceptionを参照してください。
@param newstate 自身を......実行中に例外発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.abort_on_exception # => false
thread.abort_on_exception = true
thread.abort_on_exception # => true
//}... -
Thread
# run -> self (9041.0) -
停止状態(stop)のスレッドを再開させます。 Thread#wakeup と異なりすぐにスレッドの切り替え を行います。
...レッドを再開させます。
Thread#wakeup と異なりすぐにスレッドの切り替え
を行います。
@raise ThreadError 死んでいるスレッドに対して実行すると発生します。
//emlist[例][ruby]{
a = Thread.new { puts "a"; Thread.stop; puts "c" }
sleep 0.1 while a.......status!='sleep'
puts "Got here"
a.run
a.join
# => a
# => Got here
# => c
//}
@see Thread#wakeup, Thread.stop... -
Thread
# value -> object (9041.0) -
スレッド self が終了するまで待ち(Thread#join と同じ)、 そのスレッドのブロックが返した値を返します。スレッド実行中に例外が 発生した場合には、その例外を再発生させます。
...ッド self が終了するまで待ち(Thread#join と同じ)、
そのスレッドのブロックが返した値を返します。スレッド実行中に例外が
発生した場合には、その例外を再発生させます。
スレッドが Thread#kill によって終了した場合は、......の終了を待ち結果を出力する例です。
threads = []
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.each {|t| p t.value}
最後の行で、待ち合......わせを行っていることがわかりにくいと思うなら以下
のように書くこともできます。
threads.each {|t| p t.join.value}... -
Thread
# alive? -> bool (9037.0) -
スレッドが「生きている」時、true を返します。
...」時、true を返します。
例:
thr = Thread.new { }
thr.join # => #<Thread:0x401b3fb0 dead>
Thread.current.alive? # => true
thr.alive? # => false
Thread#status が真を返すなら、このメソッドも真です。
@see Thread#status, Thread#stop?... -
Thread
# set _ trace _ func(pr) -> Proc | nil (9037.0) -
スレッドにトレース用ハンドラを設定します。
...nil を渡すとトレースを解除します。
設定したハンドラを返します。
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 2, nil,......fc8de967798>, Thread]
# => ["c-return", "example.rb", 5, :current, #<Binding:0x00007fc8de9673b0>, Thread]
# => ["c-call", "example.rb", 5, :set_trace_func, #<Binding:0x00007fc8de966fc8>, Thread]
//}
@param pr トレースハンドラ(Proc オブジェクト) もしくは nil
@see Thread#add_trace_f... -
Thread
# fetch(name , default = nil) {|name| . . . } -> object (9031.0) -
name に関連づけられたスレッドに固有のデータを返します。 name に対応するスレッド固有データがない時には、引数 default が 与えられていればその値を、ブロックが与えられていれば そのブロックを評価した値を返します。
...と発生します。
//emlist[例][ruby]{
th = Thread.new { Thread.current[:name] = 'A' }
th.join
th.fetch(:name) # => "A"
th.fetch(:fetch, 'B') # => "B"
th.fetch('name') {|name| "Thread" + name} # => "A"
th.fetch('fetch') {|name| "Thread" + name} # => "Threadfetch"
//}
@see Thread#[]... -
Thread
# stop? -> bool (9031.0) -
スレッドが終了(dead)あるいは停止(stop)している時、true を返します。
...スレッドが終了(dead)あるいは停止(stop)している時、true を返します。
//emlist[例][ruby]{
a = Thread.new { Thread.stop }
b = Thread.current
a.stop? # => true
b.stop? # => false
//}
@see Thread#alive?, Thread#status... -
Thread
# inspect -> String (9025.0) -
自身を人間が読める形式に変換した文字列を返します。
...自身を人間が読める形式に変換した文字列を返します。
//emlist[例][ruby]{
a = Thread.current
a.inspect # => "#<Thread:0x00007fdbaf07ddb0 run>"
b = Thread.new{}
b.inspect # => "#<Thread:0x00007fdbaf8f7d10@(irb):3 dead>"
//}...