Skip to content

Improve Ractor-compliance - #2

Open
rm155 wants to merge 1 commit into
ruby:masterfrom
rm155:master
Open

Improve Ractor-compliance#2
rm155 wants to merge 1 commit into
ruby:masterfrom
rm155:master

Conversation

@rm155

Copy link
Copy Markdown

By using Ractor-local storage instead of class variables, WeakRef can be used within Ractors.

@rkh

rkh commented Jul 28, 2026

Copy link
Copy Markdown

There's been no movement on this.

Anyway, this still means WeakRef instances cannot be sent over a Port. They will lose their reference to the object even if it hasn't been garbage collected.

Comment threadlib/weakref.rb
end

def weakref_map
if defined?(::Object::Ractor)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ifdefined?(::Object::Ractor)
ifdefined?(::Ractor)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rm155@rkh@eregon