Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fiber isolation #825

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Add fiber isolation #825

merged 1 commit into from
Nov 26, 2024

Conversation

joeldrapper
Copy link
Collaborator

@joeldrapper joeldrapper commented Nov 26, 2024

Thread locals are not Fiber-isolated and neither are Fiber locals Thread-isolated. The approach taken in this PR is to use a Thread local, storing the current fiber ID with the value. Then we can check the ids match when reading.

@joeldrapper joeldrapper marked this pull request as ready for review November 26, 2024 15:08
@joeldrapper joeldrapper merged commit d077fdc into main Nov 26, 2024
11 checks passed
@joeldrapper joeldrapper deleted the add-fiber-isolation branch November 26, 2024 21:07
@fcheung
Copy link

fcheung commented Nov 26, 2024

I won’t pretend to understand the code here, but given that you’re requiring Ruby 3.2 could you use Fiber[] (fiber storage - per fiber but inherited from parent fibers/threads) ?

@joeldrapper
Copy link
Collaborator Author

As far as I can tell, Fiber[] does not give you Thread isolation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants