るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. rsa p
  5. dsa p

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 > >>

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

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

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

@param timeout スリープする秒数を指定します。省略するとスリープし続けます。

@return スリープしていた秒数を返します。

@raise ThreadError...
...グナルを受信した場合などに実行が再
開(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::Mutex#sleep(timeout = nil) -> Integer (24226.0)

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

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

@param timeout スリープする秒数を指定します。省略するとスリープし続けます。

@return スリープしていた秒数を返します。

@raise ThreadError...
...グナルを受信した場合などに実行が再
開(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
//}...
...与えられた秒数の間ロックを解除してスリープして、実行後にまたロックします。

@param timeout スリープする秒数を指定します。省略するとスリープし続けます。

@return タイムアウトした時は nil を、それ以外はスリープし...

ThreadsWait#empty? -> bool (6125.0)

同期されるスレッドが存在するならば true をかえします。

...ッドが存在するならば true をかえします。

使用例
require 'thwait'

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

thall = ThreadsWait.new
p
thall.threads.empty? #=> true
thall.join(*threads)
p
thall.threads.empty? #=> false...

Thread#wakeup -> self (6113.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#abort_on_exception -> bool (6107.0)

真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、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) (6107.0)

真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、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#priority -> Integer (6107.0)

スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。

...スレッドの
p
riority を引き継ぎます。

@param val スレッドの優先度を指定します。プラットフォームに依存します。

//emlist[例][ruby]{
Thread.current.priority # => 0

count1 = count2 = 0
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1

b...
...= Thread.new do
loop { count2 += 1 }
end
b.priority = -2
count1 = count2 = 0 # reset
sleep
1 # => 1
count1 # => 13809431
count2 # => 11571921
//}...

Thread#priority=(val) (6107.0)

スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。

...スレッドの
p
riority を引き継ぎます。

@param val スレッドの優先度を指定します。プラットフォームに依存します。

//emlist[例][ruby]{
Thread.current.priority # => 0

count1 = count2 = 0
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1

b...
...= Thread.new do
loop { count2 += 1 }
end
b.priority = -2
count1 = count2 = 0 # reset
sleep
1 # => 1
count1 # => 13809431
count2 # => 11571921
//}...

SignalException#signo -> Integer (3019.0)

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

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

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

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

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

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

...ープを自身に変更します。

@param thread 自身に加えたいスレッドを指定します。

@raise ThreadError 自身が freeze されているか enclose されている場合に、発生します。また引数 thread が属する ThreadGroup が freeze されているか enclose...
...ruby]{
p
uts "Initial group is #{ThreadGroup::Default.list}"
# => Initial group is [#<Thread:0x4a49168 run>]

tg = ThreadGroup.new
t1 = Thread.new { sleep }
t2 = Thread.new { sleep }
p
uts "t1 is #{t1}" # => t1 is #<Thread:0x50bef60>
p
uts "t2 is #{t2}" # => t2 is #<Thread:0x50beed0>
tg.add(t1)
p
uts "I...
...nitial group now #{ThreadGroup::Default.list}"
# => Initial group now [#<Thread:0x3039168 run>, #<Thread:0x50beed0 run>]
p
uts "tg group now #{tg.list}"
# => tg group now [#<Thread:0x50bef60 run>]
//}...

絞り込み条件を変える

<< 1 2 3 > >>