59件ヒット
[1-59件を表示]
(0.010秒)
種類
- インスタンスメソッド (33)
- 文書 (26)
クラス
- Mutex (2)
-
Thread
:: ConditionVariable (22) -
Thread
:: Mutex (9)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 3
. 0 . 0 (4) - broadcast (11)
-
ruby 1
. 6 feature (11) - signal (11)
検索結果
先頭5件
-
Mutex
# sleep(timeout = nil) -> Integer (39131.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
:: Mutex # sleep(timeout = nil) -> Integer (21131.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
//}... -
NEWS for Ruby 2
. 0 . 0 (102.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ct.const_get("Foo::Bar::Baz")
//}
* Mutex
* 追加(実験的): Mutex#owned? mutex が現在のスレッドに所持されているかどうかを返します
* 非互換:
* Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize, Mutex#sleep
はトラップハンドラ......の中では使えなくなりました。そのようなときは ThreadError が発生します
* Mutex#sleep may spurious wakeup. Check after wakeup.
* NilClass
* 追加: NilClass#to_h 空のハッシュを返します
* ObjectSpace::WeakMap
* 弱い参照を保持するため......one, Object#initialize_dup
* private になりました
* Thread#join, Thread#value
* 上を参照
* Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize, Mutex#sleep
* 上を参照
=== 標準添付ライブラリの更新 (優れたもののみ)
* cgi
* HTML5 用の... -
ruby 1
. 6 feature (78.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...するとエラーになっていました。
((<ruby-dev:17155>))
open("|-","r+") {|f|
if f
f.dup.close_write
else
sleep 1
end
}
=> ruby 1.6.7 (2002-03-01) [i586-linux]
-:3:in `close_write': closing non-duplex IO for writing (IOError)......修正さ
れました。((<ruby-bugs-ja:PR#223>))
trap(:TERM, "EXIT")
END{
puts "exit"
}
Thread.start { Thread.stop }
sleep
: 2002-04-17: Regexp#inspect
((<ruby-bugs-ja:PR#222>))
p %r{\/}
=> ruby 1.6.7 (2002-03-01) [i586-linux]
/\\//
=> ruby......<ruby-dev:13659>))
: sync
: mutex_m
Fixed for obj.extend(Sync_m) and obj.extend(Mutex_m).((<ruby-dev:13463>))
$ ruby -v -rsocket -rmutex_m -e 's=TCPSocket.new("localhost",25); s.extend(Mutex_m)'
ruby 1.6.4 (2001-06-04) [i386-linux]
/usr/lib/ruby/1.6/mutex_m.rb:104:in `initialize': w... -
Thread
:: ConditionVariable # broadcast -> self (52.0) -
状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
...ait
で指定した 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
:: ConditionVariable # signal -> self (52.0) -
状態変数を待っているスレッドを1つ再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
...ait
で指定した 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.signal
}
}
sleep 1
# => a1
# => a1
# => a1
# => a2
//}... -
NEWS for Ruby 3
. 0 . 0 (24.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...for `__LINE__` in the evaluated code. 4352
* Kernel#lambda now warns if called without a literal block. 15973
* Kernel.sleep invokes the scheduler hook `#kernel_sleep(...)` in a non-blocking execution context. 16786
* Module
* Module#include and Module#prepend now affect classes and mo......y]{
class C; end
module M1; end
module M2; end
C.include M1
M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}
* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change should be compatible for essentially all usages and avoids blocking when...