Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions core/ractor.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,23 @@ class Ractor
#
def self.shareable?: (untyped obj) -> bool

# <!--
# rdoc-file=ractor.rb
# - Ractor.store_if_absent(key){ init_block }
# -->
# If the correponding value is not set, yield a value with init_block and store
# the value in thread-safe manner. This method returns corresponding stored
# value.
#
# (1..10).map{
# Thread.new(it){|i|
# Ractor.store_if_absent(:s){ f(); i }
# #=> return stored value of key :s
# }
# }.map(&:value).uniq.size #=> 1 and f() is called only once
#
def self.store_if_absent: (Symbol) { () -> untyped } -> untyped

# <!--
# rdoc-file=ractor.rb
# - Ractor.yield(msg, move: false) -> nil
Expand Down
Loading