るりまサーチ

最速Rubyリファレンスマニュアル検索!
81件ヒット [1-81件を表示] (0.019秒)
トップページ > クエリ:join[x] > クエリ:SizedQueue[x]

別のキーワード

  1. _builtin join
  2. socket ipv6_join_group
  3. socket mcast_join_group
  4. socket mcast_join_source_group
  5. uri join

ライブラリ

クラス

キーワード

検索結果

Thread::SizedQueue (18018.0)

サイズの最大値を指定できる Thread::Queue です。

...り。q をサイズ 1 の SizedQueue オブジェクトに
することによって、入力される行と出力される行が同じ順序になります。
q = [] にすると入力と違った順序で行が出力されます。

require 'thread'

q = SizedQueue.new(1)

th = Thread.start...
...{
while line = q.pop
print line
end
}

while l = gets
q.push(l)
end
q.push(l)

th.join...

Thread::SizedQueue#deq(non_block = false) -> object (3024.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...ad'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

th1.join
# => resource1
# resource2
# resource3
//}

//emlist[例: nonblock = true][ruby]{
require 'thread'

q = SizedQueue.new(4)...
...Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resource1
# resource2
# resource3
# => #<ThreadError: queue empty>
# => "queue empty"
//}...

Thread::SizedQueue#pop(non_block = false) -> object (3024.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...ad'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

th1.join
# => resource1
# resource2
# resource3
//}

//emlist[例: nonblock = true][ruby]{
require 'thread'

q = SizedQueue.new(4)...
...Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resource1
# resource2
# resource3
# => #<ThreadError: queue empty>
# => "queue empty"
//}...

Thread::SizedQueue#shift(non_block = false) -> object (3024.0)

キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。

...ad'

q = SizedQueue.new(4)

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

th1.join
# => resource1
# resource2
# resource3
//}

//emlist[例: nonblock = true][ruby]{
require 'thread'

q = SizedQueue.new(4)...
...Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end

# => resource1
# resource2
# resource3
# => #<ThreadError: queue empty>
# => "queue empty"
//}...

ruby 1.6 feature (66.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...by-core:00019>))

: 2002-09-11: Queue#((<Queue/pop>))

Queue#pop に競合状態の問題がありました ((<ruby-dev:17223>))

: 2002-09-11: SizedQueue.new

引数に 0 以下を受けつけるバグが修正されました。

: 2002-09-05: ((<リテラル/式展開>))

stable snapshot で...
...=> ruby 1.6.8 (2002-10-04) [i586-linux]
""
=> -:1: parse error
ruby 1.7.3 (2002-10-04) [i586-linux]

: SizedQueue#deq, #shift
: SizedQueue#enq

追加(push, pop の別名)。これらが定義されていなかったため、enq などを
呼び出したときスー...
...$SAFE = 4
a.life -= 1
end.join
p a.life
=> ruby 1.6.4 (2001-06-04) [i586-linux]
6
=> ruby 1.6.4 (2001-08-06) [i586-linux]
-:6:in `life=': Insecure: can't modify Struct (SecurityError)
from -:3:in `join'
from -:3

: ((<String>))#rind...

絞り込み条件を変える

NEWS for Ruby 3.0.0 (30.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...? are now defined and will return true for separate Proc instances if the procs were created from the same block. 14267
* Queue / SizedQueue
* Queue#pop, SizedQueue#push and related methods may now invoke the `block`/`unblock` scheduler hooks in a non-blocking context. 16786
* Ractor
* N...
...d and how to implement the scheduler hooks. 16786
* Fiber.blocking? tells whether the current execution context is blocking. 16786
* Thread#join invokes the scheduler hooks `block`/`unblock` in a non-blocking execution context. 16786
* Thread
* Thread.ignore_deadlock accessor has been...
...ompatible.
* Set
* Update to set 1.0.0
* SortedSet has been removed for dependency and performance reasons.
* Set#join is added as a shorthand for `.to_a.join`.
* Set#<=> is added.
* Socket
* Add :connect_timeout to TCPSocket.new 17187
* Net::HTTP
* Net::HTTP#verify_hos...

Thread::Queue (12.0)

Queue はスレッド間の FIFO(first in first out) の通信路です。ス レッドが空のキューを読み出そうとすると停止します。キューになんら かの情報が書き込まれると実行は再開されます。

...ブクラス Thread::SizedQueue も提供されています。

=== 例

require 'thread'

q = Queue.new

th1 = Thread.start do
while resource = q.pop
puts resource
end
end

[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}

th1.join

実行すると以...

Thread::Queue#num_waiting -> Integer (12.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
//}...