ライブラリ
クラス
- Exception (12)
- Fiber (24)
-
IRB
:: Context (12) - Monitor (6)
- Mutex (4)
-
Net
:: IMAP (48) -
Net
:: IMAP :: ThreadMember (12) -
Rake
:: Application (12) - Thread (318)
-
Thread
:: Backtrace :: Location (84) -
Thread
:: ConditionVariable (36) -
Thread
:: Mutex (50) -
Thread
:: Queue (68) -
Thread
:: SizedQueue (79) - ThreadGroup (24)
- ThreadsWait (12)
- Tracer (12)
-
WEBrick
:: GenericServer (12)
キーワード
- << (11)
- [] (12)
- []= (12)
-
abort
_ on _ exception (12) -
abort
_ on _ exception= (12) -
absolute
_ path (12) -
add
_ trace _ func (12) - 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)
- enclose (12)
- enclosed? (12)
- enq (11)
- exit (12)
- fetch (8)
-
get
_ thread _ no (12) - group (12)
-
ignore
_ deadlock (4) -
ignore
_ deadlock= (4) - inspect (24)
- key? (12)
- keys (12)
- kill (12)
- label (12)
- lineno (12)
- lock (12)
- locked? (10)
-
next
_ wait (6) - path (12)
- pop (24)
- push (11)
- raise (12)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) - resume (12)
- run (12)
-
set
_ trace _ func (12) - shift (24)
- signal (12)
- status (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) - 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件
-
IRB
:: Context # thread -> Thread (21209.0) -
現在のスレッドを返します。
...現在のスレッドを返します。
@see Thread.current... -
Net
:: IMAP # thread(algorithm , search _ keys , charset) -> [Net :: IMAP :: ThreadMember] (18436.0) -
THREADコマンドを送り、メールボックスを検索した結果を スレッド形式の木構造で返します。
...THREADコマンドを送り、メールボックスを検索した結果を
スレッド形式の木構造で返します。
THREAD コマンドは 5256 で定義されています。
詳しくはそちらを参照してください。
このコマンドは Net::IMAP#capability の返り値を見......す。
* "ORDEREDSUBJECT" subjectを使って平坦に区切るだけ
* "REFERENCES" どのメッセージに返事をしているかを見て木構造を作る
詳しくは 5256 を見てください。
search_key には検索条件を渡します。
Net::IMAP#search と同等です。
@para......m algorithm スレッド構造構築アルゴリズム名(文字列)
@param search_key 検索条件(文字列配列)
@param charset 検索条件の解釈に用いるCHARSET名(文字列)
@see Net::IMAP::ThreadMember, Net::IMAP#uid_thread... -
Thread
:: ConditionVariable # broadcast -> self (17129.0) -
状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
... Thread::ConditionVariable#wait
で指定した mutex のロックを試みます。
@return 常に self を返します。
//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true
3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
cv.......wait(mutex)
end
puts "a2"
}
}
}
Thread.start {
mutex.synchronize {
flg = false
cv.broadcast
}
}
sleep 1
# => a1
# => a1
# => a1
# => a2
# => a2
# => a2
//}... -
Thread
:: Queue # clear -> () (17107.0) -
キューを空にします。返り値は不定です。
...キューを空にします。返り値は不定です。
//emlist[例][ruby]{
require 'thread'
q = Queue.new
[:resource1, :resource2, :resource3, nil].each { |r| q.push(r) }
q.length # => 4
q.clear
q.length # => 0
//}... -
Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil (15371.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します.......#caller_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 (15371.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します.......#caller_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
# thread _ variable _ get(key) -> object | nil (15286.0) -
引数 key で指定した名前のスレッドローカル変数を返します。
...意]: Thread#[] でセットしたローカル変数(Fiber ローカル変数)と
異なり、Fiber を切り替えても同じ変数を返す事に注意してください。
例:
Thread.new {
Thread.current.thread_variable_set("foo", "bar") # スレッドローカル
Thread.current["f......
Thread.current.thread_variable_get("foo"), # スレッドローカル
Thread.current["foo"], # Fiber ローカル
]
}.resume
}.join.value # => ['bar', nil]
この例の "bar" は Thread#thread_variable_get により得られ
た値で、nil はThread......#[] により得られた値です。
@see Thread#thread_variable_set, Thread#[]
@see https://magazine.rubyist.net/articles/0041/0041-200Special-note.html... -
Thread
# set _ trace _ func(pr) -> Proc | nil (15191.0) -
スレッドにトレース用ハンドラを設定します。
...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, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:0x00007fc8de886770>, Class......]
# => ["c-return", "example.rb", 2, :inherited, #<Binding:0x00007fc8de8844e8>, Class]
# => ["class", "example.rb", 2, nil, #<Binding:0x00007fc8de88e830>, nil]
# => ["end", "example.rb", 3, nil, #<Binding:0x00007fc8de88d6b0>, nil]
# => ["line", "example.rb", 4, nil, #<Binding:0x00007fc8de88c440>, ni......=> ["c-call", "example.rb", 4, :to_s, #<Binding:0x00007fc8de896f30>, Integer]
# => ["c-return", "example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]
# => ["line", "example.rb", 5, nil, #<Binding:0x00007fc8de967b08>, nil]
# => ["c-call", "example.rb", 5, :current, #<Binding:0x00007fc8de96... -
Thread
# report _ on _ exception -> bool (15167.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exceptio......#<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_excep......tion = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# report _ on _ exception=(newstate) (15167.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exceptio......#<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_excep......tion = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# thread _ variable?(key) -> bool (15162.0) -
引数 key で指定した名前のスレッドローカル変数が存在する場合に true、そ うでない場合に false を返します。
...= Thread.current
me.thread_variable_set(:oliver, "a")
me.thread_variable?(:oliver) # => true
me.thread_variable?(:stanley) # => false
[注意]: Thread#[] でセットしたローカル変数(Fiber ローカル変数)が
対象ではない事に注意してください。
@see Thread......#thread_variable_get, Thread#[]...