るりまサーチ

最速Rubyリファレンスマニュアル検索!
177件ヒット [101-177件を表示] (0.271秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 >>

Thread#report_on_exception -> bool (8019.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...//emlist[例][ruby]{
a = Thread.new{ Thread.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 ir...
...b_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) (8019.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...//emlist[例][ruby]{
a = Thread.new{ Thread.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 ir...
...b_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...

Mutex#sleep(timeout = nil) -> Integer (8007.0)

与えられた秒数の間ロックを解除してスリープして、実行後にまたロックします。

...グナルを受信した場合などに実行が再
開(spurious wakeup)される場合がある点に注意してください。

//emlist[例][ruby]{
m = Mutex.new
th = Thread.new do
m.lock
m.sleep(2)
end
th.status # => "run"
sleep 1
th.status # => "sleep"
sleep 1
th.status # => false
//}...

Thread#backtrace_locations(range) -> [Thread::Backtrace::Location] | nil (8007.0)

スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。

...似ていますが、本メソッドは 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 (8007.0)

スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。

...似ていますが、本メソッドは 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#inspect -> String (8007.0)

自身を人間が読める形式に変換した文字列を返します。

...自身を人間が読める形式に変換した文字列を返します。

//emlist[例][ruby]{
a = Thread.current
a.inspect # => "#<Thread:0x00007fdbaf07ddb0 run>"
b = Thread.new{}
b.inspect # => "#<Thread:0x00007fdbaf8f7d10@(irb):3 dead>"
//}...

Thread#to_s -> String (8007.0)

自身を人間が読める形式に変換した文字列を返します。

...自身を人間が読める形式に変換した文字列を返します。

//emlist[例][ruby]{
a = Thread.current
a.inspect # => "#<Thread:0x00007fdbaf07ddb0 run>"
b = Thread.new{}
b.inspect # => "#<Thread:0x00007fdbaf8f7d10@(irb):3 dead>"
//}...

Thread::Mutex#sleep(timeout = nil) -> Integer (8007.0)

与えられた秒数の間ロックを解除してスリープして、実行後にまたロックします。

...グナルを受信した場合などに実行が再
開(spurious wakeup)される場合がある点に注意してください。

//emlist[例][ruby]{
m = Mutex.new
th = Thread.new do
m.lock
m.sleep(2)
end
th.status # => "run"
sleep 1
th.status # => "sleep"
sleep 1
th.status # => false
//}...

ThreadGroup#list -> [Thread] (8007.0)

self に属するスレッドの配列を返します。 version 1.8 では、aborting 状態であるスレッド も要素に含まれます。つまり「生きている」スレッドの配列を返します。

...するスレッドの配列を返します。
version 1.8 では、aborting 状態であるスレッド
も要素に含まれます。つまり「生きている」スレッドの配列を返します。

//emlist[例][ruby]{
ThreadGroup::Default.list # => [#<Thread:0x00007f8f13867078 run>]
//}...
<< < 1 2 >>