るりまサーチ

最速Rubyリファレンスマニュアル検索!
157件ヒット [1-100件を表示] (0.077秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:_builtin[x] > クエリ:new[x] > クエリ:stop[x] > 種類:インスタンスメソッド[x]

別のキーワード

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

クラス

キーワード

検索結果

<< 1 2 > >>

Thread#stop? -> bool (14144.0)

スレッドが終了(dead)あるいは停止(stop)している時、true を返します。

...スレッドが終了(dead)あるいは停止(stop)している時、true を返します。

//emlist[例][ruby]{
a = Thread.new { Thread.stop }
b = Thread.current
a.stop? # => true
b.stop? # => false
//}

@see Thread#alive?, Thread#status...

StopIteration#result -> object (11009.0)

この例外オブジェクトを発生させる原因となったメソッド等の返り値を返します。

...を返します。

object = Object.new
def object.each
yield :yield1
yield :yield2
:each_returned
end

enumerator = object.to_enum

p enumerator.next #=> :yield1
p enumerator.next #=> :yield2

begin
enumerator.next
rescue StopIteration => error
p error.result #...

Thread#report_on_exception=(newstate) (8127.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_excep...
...aceback (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#status -> String | false | nil (8039.0)

生きているスレッドの状態を文字列 "run"、"sleep", "aborting" のいず れかで返します。正常終了したスレッドに対して false、例外によ り終了したスレッドに対して 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#run -> self (8037.0)

停止状態(stop)のスレッドを再開させます。 Thread#wakeup と異なりすぐにスレッドの切り替え を行います。

...止状態(stop)のスレッドを再開させます。
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#wakeup -> self (8037.0)

停止状態(stop)のスレッドを実行可能状態(run)にします。

...停止状態(stop)のスレッドを実行可能状態(run)にします。

@raise ThreadError 死んでいるスレッドに対して実行すると発生します。

//emlist[例][ruby]{
c = Thread.new { Thread.stop; puts "hey!" }
sleep 0.1 while c.status!='sleep'
c.wakeup
c.join
# => "hey!"
//}...
...@see Thread#run, Thread.stop...

Thread#report_on_exception -> bool (8027.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_excep...
...aceback (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...

Time#strftime(format) -> String (8027.0)

時刻を format 文字列に従って文字列に変換した結果を返します。

...空白埋めにする
* 0: 0埋めにする
* 数値: 表示桁数を指定する
EとOは無視されます。

//emlist[例][ruby]{
p t = Time.new(2001,2,3,4,5,6,"+09:00") # => 2001-02-03 04:05:06 +0900
p t.strftime("Printed on %m/%d/%Y") # => "Printed on 02/03/2001"
p t.strftime("Printe...
...") # => "at 04:05AM"
p t.strftime("at %I:%M%#p") # => "at 04:05am"
//}

//emlist[様々なISO 8601形式][ruby]{
t = Time.new(2001,2,3,4,5,6,"+09:00")
p t.strftime("%Y%m%d") # => 20010203 Calendar date (basic)
p t.strftime("%F") # =...
....%L") # => 040506.000 Local time with decimal fraction, full stop as decimal sign (basic)
p t.strftime("%T.%L") # => 04:05:06.000 Local time with decimal fraction, full stop as decimal sign (extended)
p t.strftime("%H%M%S%z") # => 040506+0900...

Thread#backtrace -> [String] | nil (8021.0)

スレッドの現在のバックトレースを返します。

...いる場合は nil を返します。

//emlist[例][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:i...

Thread::Queue#num_waiting -> Integer (8021.0)

キューを待っているスレッドの数を返します。

...キューを待っているスレッドの数を返します。

//emlist[例][ruby]{
require 'thread'

q = SizedQueue.new(1)
q.push(1)
t = Thread.new { q.push(2) }
sleep 0.05 until t.stop?
q.num_waiting # => 1

q.pop
t.join
//}...

絞り込み条件を変える

<< 1 2 > >>