種類
ライブラリ
クラス
- Exception (12)
- Fiber (24)
- IO (120)
-
IRB
:: Context (12) - Monitor (24)
- Mutex (6)
-
Net
:: IMAP (24) - PStore (12)
- Shell (20)
- Socket (48)
- Thread (516)
-
Thread
:: Backtrace :: Location (72) -
Thread
:: ConditionVariable (36) -
Thread
:: Mutex (40) -
Thread
:: Queue (44) -
Thread
:: SizedQueue (106) - ThreadGroup (24)
- ThreadsWait (36)
- TracePoint (12)
- Tracer (24)
-
YAML
:: Store (18)
モジュール
キーワード
-
$ -d (12) -
$ DEBUG (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - << (12)
- ConditionVariable (12)
- DEBUG (12)
- DEBUG= (12)
- ErrNoFinishedThread (6)
- ErrNoWaitingThread (6)
- Location (12)
- MonitorMixin (12)
-
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - Ruby用語集 (12)
- Thread (12)
- [] (12)
- []= (12)
-
abort
_ on _ exception (24) -
abort
_ on _ exception= (24) -
absolute
_ path (12) - add (12)
-
add
_ trace _ func (12) - alive? (12)
-
all
_ waits (12) - application= (12)
-
backtrace
_ locations (36) -
base
_ label (12) - broadcast (12)
-
caller
_ locations (24) -
clock
_ gettime (12) - close (10)
-
count
_ tdata _ objects (12) -
debug
_ output _ lock (4) -
debug
_ output _ locked? (4) -
debug
_ output _ synchronize (4) -
debug
_ output _ try _ lock (4) -
debug
_ output _ unlock (4) - deq (24)
- detach (12)
-
display
_ thread _ id= (12) -
drb
/ extservm (12) -
drb
/ gw (12) - dump (24)
- enclosed? (12)
- enq (12)
- eof (12)
- eof? (12)
- exit (24)
- fetch (8)
- fork (12)
-
get
_ thread _ no (12) -
handle
_ interrupt (12) -
ignore
_ deadlock (4) -
ignore
_ deadlock= (4) - inspect (12)
- join (30)
-
join
_ nowait (6) - key? (12)
- kill (24)
- label (12)
- lock (12)
- max= (12)
-
mon
_ exit (6) - name (10)
- name= (10)
- new (80)
-
next
_ wait (6) - path (12)
-
pending
_ interrupt? (24) - pipe (96)
-
pipeline
_ r (24) -
pipeline
_ rw (24) -
pipeline
_ start (24) -
pipeline
_ w (24) - pop (24)
- popen2 (24)
- popen2e (24)
- popen3 (24)
- priority (12)
- priority= (12)
- push (12)
- raise (12)
-
rb
_ thread _ schedule (12) -
report
_ on _ exception (18) -
report
_ on _ exception= (18) - resume (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) - run (12)
-
set
_ trace _ func (12) - shift (24)
- signal (12)
- sleep (36)
- start (12)
- status (12)
- stop (12)
- stop? (12)
-
sync
_ ex _ locker (6) -
sync
_ ex _ locker= (6) -
sync
_ upgrade _ waiting (6) -
sync
_ waiting (6) - synchronize (10)
-
tcp
_ server _ loop (24) - terminate (12)
-
thread
_ variable? (12) -
thread
_ variable _ get (12) -
thread
_ variable _ set (12) - timeout (37)
-
to
_ s (12) - transfer (12)
-
uid
_ thread (12) - unix (24)
- unlock (12)
- wait (12)
-
wait
_ for _ cond (6) - wakeup (12)
- yaml (12)
- スレッド (12)
- セキュリティモデル (12)
検索結果
先頭5件
-
Thread
. pending _ interrupt?(error = nil) -> bool (9090.0) -
非同期割り込みのキューが空かどうかを返します。
...します。
Thread.handle_interrupt は非同期割り込みの発生を延期させるのに使
用しますが、本メソッドは任意の非同期割り込みが存在するかどうかを確認す
るのに使用します。
本メソッドが true を返した場合、Thread.handle_interru......できます。
@param error 対象の例外クラスを指定します。省略した場合は全ての例外を対
象に確認を行います。
例: 延期させられていた例外をただちに発生させる。
def Thread.kick_interrupt_immediately
Thread.handle_interr......e) {
Thread.pass
}
end
=== 使い方
th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# ここまでで割り込みが発生しても安全な状態になった。
if Thread.pending_interrupt?
Thread.ha... -
Thread
# status -> String | false | nil (9072.0) -
生きているスレッドの状態を文字列 "run"、"sleep", "aborting" のいず れかで返します。正常終了したスレッドに対して false、例外によ り終了したスレッドに対して nil を返します。
...て nil を返します。
Thread#alive? が真を返すなら、このメソッドも真です。
例:
a = Thread.new { raise("die now") }
b = Thread.new { Thread.stop }
c = Thread.new { Thread.exit }
d = Thread.new { sleep }
d.kill #=> #<Thread:0x401b3678 aborting>
a.......status #=> nil
b.status #=> "sleep"
c.status #=> false
d.status #=> "aborting"
Thread.current.status #=> "run"
@see Thread#alive?, Thread#stop?... -
Thread
# report _ on _ exception -> bool (9066.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...ルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception......true
a.run
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.......report_on_exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# report _ on _ exception=(newstate) (9066.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...ルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception......true
a.run
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.......report_on_exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# abort _ on _ exception -> bool (9058.0) -
真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。
...あるスレッドで起こった例
外は、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) (9058.0) -
真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。
...あるスレッドで起こった例
外は、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
# fetch(name , default = nil) {|name| . . . } -> object (9054.0) -
name に関連づけられたスレッドに固有のデータを返します。 name に対応するスレッド固有データがない時には、引数 default が 与えられていればその値を、ブロックが与えられていれば そのブロックを評価した値を返します。
...ブロックを評価した値を返します。
@param name スレッド固有データのキーを文字列か Symbol で指定します。
@param default name に対応するスレッド固有データがない時の返り値を指定します。
@raise KeyError 引数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
# run -> self (9052.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
# set _ trace _ func(pr) -> Proc | nil (9048.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
. abort _ on _ exception -> bool (9046.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例外は、Thread#join などで検出されない限りそのスレッドだけをなにも警告を出さずに終了させます。
...るスレッドで起こった例外は、Thread#join
などで検出されない限りそのスレッドだけをなにも警告を出さずに終了させます。
デフォルトは false です。
c:Thread#exceptionを参照してください。
@param newstate スレッド実行中に例外......発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。
//emlist[例][ruby]{
Thread.abort_on_exception # => false
Thread.abort_on_exception = true
Thread.abort_on_exception # => true
//}...