Project

General

Profile

Actions

Feature #20715

closed

`Ractor.[]` and `Ractor.[]=` to access Ractor local storage

Added by ko1 (Koichi Sasada) 4 months ago. Updated about 1 month ago.

Status:
Closed
Target version:
-
[ruby-core:119050]

Description

Trivial proposal.

Now Ractor#[]/#[]= is supported to access current ractor local storage. However, it doesn't allow to access local storage of other ractors.

Ractor.current[:foo] = 1

Ractor.new{ 
  p Ractor.main[:foo] #=> nil
}.take

So providing Ractor.[]/[]= is more reasonable.
Further more, we don't need to use Ractor#current and it is slightly faster.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0