29件ヒット
[1-29件を表示]
(0.018秒)
別のキーワード
検索結果
-
Fiber (38114.0)
-
ノンプリエンプティブな軽量スレッド(以下ファイバーと呼ぶ)を提供します。 他の言語では coroutine あるいは semicoroutine と呼ばれることもあります。 Thread と違いユーザレベルスレッドとして実装されています。
...係を持ちます。Fiber#resume を呼んだファイバーが親になり
呼ばれたファイバーが子になります。親子関係を壊すような遷移(例えば
自分の親の親のファイバーへ切り替えるような処理)はできません。
例外 FiberError が発生しま......す。
できることは
* Fiber#resume により子へコンテキストを切り替える
* Fiber.yield により親へコンテキストを切り替える
の二通りです。この親子関係は一時的なものであり
親ファイバーへコンテキストを切り替えた時点で解......レッド間をまたがるファイバーの切り替えはできません。
例外 FiberError が発生します。
//emlist[例:][ruby]{
f = nil
Thread.new do
f = Fiber.new{}
end.join
f.resume
#=> t.rb:5:in `resume': fiber called across threads (FiberError)
# from t.rb:5:in `<main>'
//}... -
NEWS for Ruby 3
. 0 . 0 (90.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...4
* Fiber
* Fiber.new(blocking: true/false) allows you to create non-blocking execution contexts. 16786
* Fiber#blocking? tells whether the fiber is non-blocking. 16786
* Fiber#backtrace and Fiber#backtrace_locations provide per-fiber backtrace. 16815
* The limitation of Fiber#tran......ule 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 using a scheduler. 16792
* Proc......JIT-ed code when not necessary.
* 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 wit... -
Enumerator (24.0)
-
each 以外のメソッドにも Enumerable の機能を提供するためのラッパークラスです。 また、外部イテレータとしても使えます。
...を実行する代わりに
enumerator を生成して返します。
=== 注意
外部イテレータとしての機能は Fiber を用いて実装されているため Fiber と同じ制限があります。
例えば以下のようなスレッドをまたいだ呼び出しはエラーになり......ます。
//emlist[例][ruby]{
a = nil
Thread.new do
a = [1, 2, 3].each
a.next
end.join
p a.next
#=> t.rb:7:in `next': fiber called across threads (FiberError)
# from t.rb:7:in `<main>'
//}...