種類
- インスタンスメソッド (441)
- 特異メソッド (222)
- 定数 (5)
ライブラリ
- ビルトイン (668)
キーワード
- DEBUG (12)
- DEBUG= (12)
-
MUTEX
_ FOR _ THREAD _ EXCLUSIVE (5) - [] (12)
- []= (12)
-
abort
_ on _ exception (24) -
abort
_ on _ exception= (24) -
add
_ trace _ func (12) - alive? (12)
- backtrace (12)
-
backtrace
_ locations (24) - current (12)
- exclusive (12)
- exit (24)
- fetch (8)
- fork (12)
- group (12)
-
handle
_ interrupt (12) -
ignore
_ deadlock (4) -
ignore
_ deadlock= (4) - inspect (12)
- join (24)
- key? (12)
- keys (12)
- kill (24)
- list (12)
- main (12)
- name (10)
- name= (10)
- new (12)
- pass (12)
-
pending
_ interrupt? (24) - priority (12)
- priority= (12)
- raise (12)
-
report
_ on _ exception (18) -
report
_ on _ exception= (18) - run (12)
-
safe
_ level (7) -
set
_ trace _ func (12) - start (12)
- status (12)
- stop (12)
- stop? (12)
- terminate (12)
-
thread
_ variable? (12) -
thread
_ variable _ get (12) -
thread
_ variable _ set (12) -
to
_ s (8) - value (12)
- wakeup (12)
検索結果
先頭5件
-
Thread
# keys -> [Symbol] (1.0) -
スレッド固有データに関連づけられたキーの配列を返します。キーは Symbol で返されます。
...スレッド固有データに関連づけられたキーの配列を返します。キーは
Symbol で返されます。
th = Thread.current
th[:foo] = 'FOO'
th['bar'] = 'BAR'
p th.keys
#=> [:bar, :foo]... -
Thread
# kill -> self (1.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...レッドの Thread#value の返り値は不定です。
自身がメインスレッドであるか最後のスレッドである場合は、プロセスを Kernel.#exit(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begi... -
Thread
# name -> String (1.0) -
self の名前を返します。
...self の名前を返します。
@see Thread#name=... -
Thread
# name=(name) -> String (1.0) -
self の名前を name に設定します。
...ームによっては pthread やカーネルにも設定を行う場合があります。
@raise ArgumentError 引数に ASCII 互換ではないエンコーディングのものを
指定した場合に発生します。
//emlist[例][ruby]{
a = Thread.new{}
a.name = 'named'......a.name # => "named"
a.inspect # => "#<Thread:0x00007f85ac8721f0@named@(irb):1 dead>"
//}
@see Thread#name... -
Thread
# pending _ interrupt?(error = nil) -> bool (1.0) -
self の非同期例外のキューが空かどうかを返します。
...self の非同期例外のキューが空かどうかを返します。
@param error 対象の例外クラスを指定します。
@see Thread.pending_interrupt?... -
Thread
# priority -> Integer (1.0) -
スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。
...定します。プラットフォームに依存します。
//emlist[例][ruby]{
Thread.current.priority # => 0
count1 = count2 = 0
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1
b = Thread.new do
loop { count2 += 1 }
end
b.priority = -2
count1 = count2 = 0 # re... -
Thread
# priority=(val) (1.0) -
スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。
...定します。プラットフォームに依存します。
//emlist[例][ruby]{
Thread.current.priority # => 0
count1 = count2 = 0
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1
b = Thread.new do
loop { count2 += 1 }
end
b.priority = -2
count1 = count2 = 0 # re... -
Thread
# raise(error _ type , message , traceback) -> () (1.0) -
自身が表すスレッドで強制的に例外を発生させます。
...してください。
@param message Kernel.#raise を参照してください。
@param traceback Kernel.#raise を参照してください。
Thread.new {
sleep 1
Thread.main.raise "foobar"
}
begin
sleep
rescue
p $!, $@
end
=> #<RuntimeError: foobar>
["-:3"]... -
Thread
# report _ on _ exception -> bool (1.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) (1.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...