るりまサーチ

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

別のキーワード

  1. drb thread
  2. thread join
  3. thread exit
  4. thread kill
  5. thread pending_interrupt?

ライブラリ

クラス

キーワード

検索結果

Fiber#transfer(*args) -> object (18113.0)

自身が表すファイバーへコンテキストを切り替えます。

... Thread クラスが表すスレッド間をまたがる場合、
Fiber#resume を呼んだファイバーがその親か先祖である場合に発生します。

//emlist[例:][ruby]{
require 'fiber'

fr1 = Fiber.new do |v|
:fugafuga
end

fr2 = Fiber.new do |v|
fr1.transfer
:...

NEWS for Ruby 2.0.0 (138.0)

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

...延列挙用のクラス

* ENV
* ENV.to_h は ENV.to_hash へのエイリアスです

* Fiber
* 非互換: Fiber#resume は Fiber#transfer を呼び出したファイバーを再開できなくなりました

* File
* 拡張: File.fnmatch? は File::FNM_EXTGLOB(File::Constants::...
...utex#try_lock, Mutex#synchronize, Mutex#sleep
はトラップハンドラの中では使えなくなりました。そのようなときは ThreadError が発生します
* Mutex#sleep may spurious wakeup. Check after wakeup.

* NilClass
* 追加: NilClass#to_h 空のハッシュ...
...加(起動時にチェックします):
* RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation.
default: 128KB (32bit CPU) or 256KB (64bit CPU).
* RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
creation. default: 512KB or 1024KB.
* RUB...

Fiber (40.0)

ノンプリエンプティブな軽量スレッド(以下ファイバーと呼ぶ)を提供します。 他の言語では coroutine あるいは semicoroutine と呼ばれることもあります。 Thread と違いユーザレベルスレッドとして実装されています。

...ます。
他の言語では coroutine あるいは semicoroutine と呼ばれることもあります。
Thread
と違いユーザレベルスレッドとして実装されています。

Thread
クラスが表すスレッドと違い、明示的に指定しない限り
ファイバーのコンテ...
...ます。

なお標準添付ライブラリ fiber を require することにより、
コンテキストの切り替えに制限のない Fiber#transfer が使えるようになります。
任意のファイバーにコンテキストを切り替えることができます。

=== 例外

ファ...
...=== 注意

Thread
クラスが表すスレッド間をまたがるファイバーの切り替えはできません。
例外 FiberError が発生します。

//emlist[例:][ruby]{
f = nil
Thread
.new do
f = Fiber.new{}
end.join
f.resume
#=> t.rb:5:in `resume': fiber called across threads (FiberEr...
...ストが切り替わります。

Ruby 3.1 から fiber を require しなくても、
コンテキストの切り替えに制限のない Fiber#transfer が使えます。
任意のファイバーにコンテキストを切り替えることができます。

=== 例外

ファイバー実行中...

NEWS for Ruby 3.0.0 (36.0)

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

...fiber is non-blocking. 16786
* Fiber#backtrace and Fiber#backtrace_locations provide per-fiber backtrace. 16815
* The limitation of Fiber#transfer is relaxed. 17221
* GC
* GC.auto_compact= and GC.auto_compact have been added to control when compaction runs. Setting `auto_compact=` to...
...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 using a scheduler. 16792
* Proc
* Proc#== and Proc#eq...
...* 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 added for disabling the default deadlock detection,...

Fiber#resume(*arg = nil) -> object (18.0)

自身が表すファイバーへコンテキストを切り替えます。 自身は resume を呼んだファイバーの子となります。

...ァイバーへコンテキストを切り替えます。
自身は resume を呼んだファイバーの子となります。

ただし、Fiber#transfer を呼び出した後に resume を呼び出す事はでき
ません。

@param arg self が表すファイバーに渡したいオブジェク...
...ンテキストの切替が
Thread
クラスが表すスレッド間をまたがる場合、自身が resume を
呼んだファイバーの親かその祖先である場合に発生します。
また、Fiber#transfer を呼び出した後に re...

絞り込み条件を変える