種類
ライブラリ
クラス
- Exception (12)
- Fiber (24)
- Monitor (42)
- Mutex (4)
-
Rake
:: Application (12) - Thread (307)
-
Thread
:: Backtrace :: Location (84) -
Thread
:: ConditionVariable (24) -
Thread
:: Mutex (50) -
Thread
:: Queue (114) -
Thread
:: SizedQueue (70) - ThreadGroup (36)
- TracePoint (12)
モジュール
- Kernel (71)
- Marshal (24)
- MonitorMixin (12)
- ObjectSpace (12)
- Rake (12)
- Timeout (21)
キーワード
-
$ SAFE (7) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - ConditionVariable (12)
- DEBUG (12)
- DEBUG= (12)
- Enumerator (12)
- Fiber (12)
- Location (12)
- Monitor (12)
- MonitorMixin (12)
-
Mutex
_ m (10) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 3
. 1 . 0 (4) - Queue (12)
- SizedQueue (12)
- [] (12)
-
abort
_ on _ exception (24) -
abort
_ on _ exception= (24) -
absolute
_ path (12) - add (12)
-
add
_ trace _ func (12) - application= (12)
- backtrace (12)
-
backtrace
_ locations (36) -
base
_ label (12) - broadcast (12)
-
caller
_ locations (24) - clear (12)
- close (10)
- closed? (10)
-
count
_ tdata _ objects (12) - deq (24)
-
drb
/ extservm (12) - dump (24)
- empty? (12)
- enter (12)
- exit (12)
- fetch (8)
-
ignore
_ deadlock= (4) - inspect (24)
- key? (12)
- label (12)
- length (12)
- lineno (12)
- list (12)
- locked? (10)
- max (12)
- max= (12)
-
mon
_ enter (18) -
mon
_ exit (6) - monitor (12)
- name= (10)
- new (32)
-
num
_ waiting (12) - owned? (12)
- path (12)
- pop (24)
- priority (12)
- priority= (12)
-
rb
_ thread _ select (1) -
rb
_ thread _ start _ timer (12) -
rb
_ thread _ stop _ timer (12) -
report
_ on _ exception (9) -
report
_ on _ exception= (9) - resume (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 8 . 5 feature (12) - run (12)
-
safe
_ level (7) -
set
_ trace _ func (12) - shift (24)
- signal (12)
- size (12)
- sleep (36)
- stop (12)
- stop? (12)
- synchronize (10)
- thread (2)
-
thread
_ variable _ set (12) - timeout (37)
-
to
_ s (20) - transfer (12)
-
try
_ lock (10) -
wait
_ for _ cond (6) - wakeup (12)
- yaml (12)
- スレッド (12)
- 終了処理 (12)
検索結果
先頭5件
-
Thread (44142.0)
-
スレッドを表すクラスです。スレッドとはメモリ空間を共有して同時に実行される制御の流れです。 Thread を使うことで並行プログラミングが可能になります。
...同時に実行される制御の流れです。
Thread を使うことで並行プログラミングが可能になります。
=== 実装
ネイティブスレッドを用いて実装されていますが、
現在の実装では Ruby VM は Giant VM lock (GVL) を有しており、同時に実......できるので、複数のスレッドを
同時に実行するような拡張ライブラリは作成可能です。
=== スケジューリング
Ruby のスレッドスケジューリングはネイティブスレッドのそれを利用しています。
よって詳細はプラットフォー......ption] 例外発生時のスレッドの振る舞い
あるスレッドで例外が発生し、そのスレッド内で rescue で捕捉されなかっ
た場合、通常はそのスレッドだけがなにも警告なしに終了されます。ただ
しその例外で終了するスレッドを T... -
Thread
# thread _ variable _ set(key , value) (36273.0) -
引数 key で指定した名前のスレッドローカル変数に引数 value をセットしま す。
...]: Thread#[] でセットしたローカル変数(Fiber ローカル変数)と
異なり、セットした変数は Fiber を切り替えても共通で使える事に注意してく
ださい。
//emlist[例][ruby]{
thr = Thread.new do
Thread.current.thread_variable_set(:cat, 'meow')
Thread.c......urrent.thread_variable_set("dog", 'woof')
end
thr.join # => #<Thread:0x401b3f10 dead>
thr.thread_variables # => [:dog, :cat]
//}
@see Thread#thread_variable_get, Thread#[]... -
thread (32018.0)
-
スレッド間キューや状態変数 (condition variable) を提供するライブラリです。
...間キューや状態変数 (condition variable) を提供するライブラリです。
このライブラリは Thread を拡張します。rubyインタプリタを
デバッグオプション付き($DEBUGを真)で実行したときには、
Thread.abort_on_exception を true にします。... -
Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil (27354.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...トレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフ......locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thread::Backtrace......::Location... -
Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil (27354.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...トレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフ......locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thread::Backtrace......::Location... -
Thread
# backtrace -> [String] | nil (27218.0) -
スレッドの現在のバックトレースを返します。
...ist[例][ruby]{
class C1
def m1
sleep 5
end
def m2
m1
end
end
th = Thread.new {C1.new.m2; Thread.stop}
th.backtrace
# => [
# [0] "(irb):3:in `sleep'",
# [1] "(irb):3:in `m1'",
# [2] "(irb):6:in `m2'",
# [3] "(irb):10:in `block in irb_binding'"
# ]
th.kill
th.......backtrace # => nil
//}... -
Thread
# report _ on _ exception -> bool (27160.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...$stderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thr......stop; raise }
a.report_on_exception = true
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) (27160.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...$stderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thr......stop; raise }
a.report_on_exception = true
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 (27158.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) (27158.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
//}...