るりまサーチ

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

別のキーワード

  1. _builtin sleep
  2. kernel sleep
  3. mutex sleep
  4. sleep _builtin

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 3 4 5 > >>

Thread#run -> self (13.0)

停止状態(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#terminate -> self (13.0)

スレッドの実行を終了させます。終了時に ensure 節が実行されます。

...it(0)
により終了します。

Kernel.#exit と違い例外 SystemExit を発生しません。

th1 = Thread.new do
begin
sleep
10
ensure
p "this will be displayed"
end
end

sleep
0.1
th1.kill

#=> "this will be displayed"

@see Kernel.#exit, Kernel.#exit!...

Thread#wakeup -> self (13.0)

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

...を実行可能状態(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...

ThreadGroup#add(thread) -> self (13.0)

スレッド thread が属するグループを自身に変更します。

...Initial group is #{ThreadGroup::Default.list}"
# => Initial group is [#<Thread:0x4a49168 run>]

tg = ThreadGroup.new
t1 = Thread.new { sleep }
t2 = Thread.new { sleep }
puts "t1 is #{t1}" # => t1 is #<Thread:0x50bef60>
puts "t2 is #{t2}" # => t2 is #<Thread:0x50beed0>
tg.add(t1)
puts "Initial group...

ThreadsWait#finished? -> bool (13.0)

すでに終了したスレッドが存在すれば true を返します。

...に終了したスレッドが存在すれば true を返します。

使用例
require 'thwait'

threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}

thall = ThreadsWait.new(*threads)
p thall.finished? #=> false
sleep
3
p thall.finished? #=> true...

絞り込み条件を変える

File::Stat#<=>(o) -> Integer | nil (7.0)

ファイルの最終更新時刻を比較します。self が other よりも 新しければ正の数を、等しければ 0 を古ければ負の数を返します。 比較できない場合は nil を返します。

...インスタンスを指定します。

//emlist[][ruby]{
require 'tempfile' # for Tempfile

fp1 = Tempfile.open("first")
fp1.print "古い方\n"
sleep
(1)
fp2 = Tempfile.open("second")
fp2.print "新しい方\n"

p File::Stat.new(fp1.path) <=> File::Stat.new(fp2.path) #=> -1
p File::Stat.new(fp2.pa...

Pathname#ctime -> Time (7.0)

File.ctime(self.to_s) を渡したものと同じです。

....ctime(self.to_s) を渡したものと同じです。

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

IO.write("testfile", "test")
pathname = Pathname("testfile")
pathname.ctime # => 2019-01-14 00:39:51 +0900
sleep
1
pathname.chmod(0755)
pathname.ctime # => 2019-01-14 00:39:52 +0900
//}

@see File.ctime...

SignalException#signm -> String (7.0)

self.message のエイリアスです。

...self.message のエイリアスです。

//emlist[例][ruby]{
begin
Process.kill('HUP', Process.pid)
sleep

rescue SignalException => e
puts e.signm # => SIGHUP
end
//}...

SignalException#signo -> Integer (7.0)

self のシグナル番号を返します。

...self のシグナル番号を返します。

//emlist[例][ruby]{
p Signal.signame(1) # => "HUP"
begin
Process.kill('HUP', Process.pid)
sleep

rescue SignalException => e
p e.signo # => 1
end
//}...

Thread#abort_on_exception -> bool (7.0)

真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。

...実行中に例外発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。

//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.abort_on_exception # => false
thread.abort_on_exception = true
thread.abort_on_exception # => true
//}...

絞り込み条件を変える

<< < 1 2 3 4 5 > >>