るりまサーチ

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

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

NEWS for Ruby 3.0.0 (26066.0)

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

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

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...s: Read ENV names and values as UTF-8 encoded Strings 12650
* Encoding
* Added new encoding IBM720. 16233
* Changed default for Encoding.default_external to UTF-8 on Windows 16604
* Fiber
* Fiber.new(blocking: true/false) allows you to create non-blocking execution contexts. 16786...
...essary.
* GC-ing JIT-ed code is executed in a background thread.
* Reduce the number of locks between Ruby and JIT threads.

== Static analysis

=== RBS

* RBS is a new language for type definition of Ruby programs. It allows writing types of classes and modules with advanced types includi...

ruby 1.8.4 feature (23174.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...ruby]: ruby インタプリタの変更
# * [api]: 拡張ライブラリ API
# * [lib]: ライブラリ
* レベル
* [bug]: バグ修正
* [new]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど
* 互換性のある変更
* on...
...* ((<ruby 1.8.4 feature/Hash [bug]>))
* ((<ruby 1.8.4 feature/test [bug]>))
* ((<ruby 1.8.4 feature/File.identical? [new]>))
* ((<ruby 1.8.4 feature/FileTest.identical? [new]>))
* ((<ruby 1.8.4 feature/File.split [change]>))
* ((<ruby 1.8.4 feature/File.basename [change]>))
* ((<ruby 1.8...
...追加されました.

#Wed Dec 7 01:02:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
#
# * ext/tk/tcltklib.c: fix bug on switching threads and waiting on the
# deleted interpreter on vwait and tkwait command.

削除された Tk インタープリタに対して vwait や...

ThreadsWait.new(*threads) -> ThreadsWait (21338.0)

指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。

...をつくります。

@param threads 終了を待つスレッドを一つもしくは複数指定します。

使用例
require 'thwait'

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

thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
pr...

ThreadsWait#threads -> Array (21137.0)

同期されるスレッドの一覧を配列で返します。

...レッドの一覧を配列で返します。

使用例
require 'thwait'

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

thall = ThreadsWait.new(*threads)
p thall.threads
#=> [#<Thread:0x21750 sleep>, #<Thread:0x216c4 sleep>, #<Thread:0x21638 slee...

ThreadsWait#join(*threads) -> () (3171.0)

終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。

...threads で指定されたスレッドを指定します。

@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。

require 'thwait'

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

thall = ThreadsWai...
...t.new
p thall.threads #=> []
thall.join(*threads)
p thall.threads
#=> [#<Thread:0x216ec dead>, #<Thread:0x21660 dead>, #<Thread:0x215d4 dead>, #<Thread:0x214bc dead>]...

絞り込み条件を変える

ThreadsWait#join_nowait(*threads) -> () (3171.0)

終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。 しかし、実際には終了をまちません。

...threads で指定されたスレッドを指定します。
しかし、実際には終了をまちません。

@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。

require 'thwait'

threads
= []
5.times {|i|
threads
<< Thread.new { s...
...leep 1; p Thread.current }
}

thall = ThreadsWait.new
p thall.threads #=> []
thall.join_nowait(*threads)
p thall.threads #=> [#<Thread:0x21638 sleep>, #<Thread:0x215ac sleep>, #<Thread:0x21520 sleep>, #<Thread:0x21494 sleep>, #<Thread:0x21408 sleep>]
# 実際には終了を待ってい...

ThreadsWait.all_waits(*threads) -> () (3132.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...クを評価します。

@param threads 終了するまでまつスレッドを一つもしくは複数指定します。

require 'thwait'

threads
= []
5.times {|i|
threads
<< Thread.new { sleep 1; p Thread.current }
}
Threads
Wait.all_waits(*threads) {|th| printf("end %s\n", th.insp...

ThreadsWait.all_waits(*threads) {|thread| ...} -> () (3132.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...クを評価します。

@param threads 終了するまでまつスレッドを一つもしくは複数指定します。

require 'thwait'

threads
= []
5.times {|i|
threads
<< Thread.new { sleep 1; p Thread.current }
}
Threads
Wait.all_waits(*threads) {|th| printf("end %s\n", th.insp...

ThreadsWait#empty? -> bool (3042.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...

ThreadsWait#all_waits -> () (3030.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...レッド終了時にブロックを評価します。

使用例
require 'thwait'

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

thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
printf("end %s\n", th.inspect)
}

# 出力例
#=>...

絞り込み条件を変える

ThreadsWait#finished? -> bool (3030.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...

ThreadsWait#next_wait(nonblock = nil) -> Thread (3030.0)

指定したスレッドのどれかが終了するまで待ちます。

... ThreadsWait::ErrNoFinishedThread が発生します。

@raise ErrNoWaitingThread 終了をまつスレッドが存在しない時、発生します。

@raise ErrNoFinishedThread nonblock がtrue でかつ、キューが空の時、発生します。

#使用例
require 'thwait'

threads
= [...
...]
2.times {|i|
threads
<< Thread.new { sleep i }
}

thall = ThreadsWait.new
thall.join_nowait(*threads)
until thall.empty?
th = thall.next_wait
p th
end

@see Queue#pop...

Thread#value -> object (54.0)

スレッド self が終了するまで待ち(Thread#join と同じ)、 そのスレッドのブロックが返した値を返します。スレッド実行中に例外が 発生した場合には、その例外を再発生させます。

...の終了を待ち結果を出力する例です。

threads
= []
threads
.push(Thread.new { n = rand(5); sleep n; n })
threads
.push(Thread.new { n = rand(5); sleep n; n })
threads
.push(Thread.new { n = rand(5); sleep n; n })

threads
.each {|t| p t.value}

最後の行で、待ち合...
...わせを行っていることがわかりにくいと思うなら以下
のように書くこともできます。

threads
.each {|t| p t.join.value}...

Thread::ConditionVariable (54.0)

スレッドの同期機構の一つである状態変数を実現するクラスです。

...クラスです。

以下も ConditionVariable を理解するのに参考になります。

https://ruby-doc.com/docs/ProgrammingRuby/html/tut_threads.html#UF

=== Condition Variable とは

あるスレッド A が排他領域で動いていたとします。スレッド A は現在空いてい...
...レッド a に対して条件が成立したことを通知します。これが典型的な
使用例です。

mutex = Mutex.new
cv = ConditionVariable.new

a = Thread.start {
mutex.synchronize {
...
while (条件が満たされない)
cv.wait(m...
...

require 'thread'

class TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mutex.new
@q = []
end

def count
@q.size
end

def enq(v)
@mutex.synchronize{
@full.w...

Thread#join -> self (48.0)

スレッド self の実行が終了するまで、カレントスレッドを停止し ます。self が例外により終了していれば、その例外がカレントス レッドに対して発生します。

...

以下は、生成したすべてのスレッドの終了を待つ例です。

threads
= []
threads
.push(Thread.new { n = rand(5); sleep n; n })
threads
.push(Thread.new { n = rand(5); sleep n; n })
threads
.push(Thread.new { n = rand(5); sleep n; n })

threads
.each {|t| t.join}...

絞り込み条件を変える

<< 1 2 > >>