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

properly synchronize globalInlineCount #5943

Merged
merged 1 commit into from Oct 26, 2019
Merged

properly synchronize globalInlineCount #5943

merged 1 commit into from Oct 26, 2019

Conversation

ahorek
Copy link
Contributor

@ahorek ahorek commented Oct 23, 2019

synchronization using a boxed primitive isn't reliable, because the field's value could be changed while a thread is in a synchronized block.

@kares
Copy link
Member

@kares kares commented Oct 24, 2019

nice find, this piece is just quite weird (there's still globalInlineCount++ against the boxed int).
@ahorek how do you feel about refactoring to simply use an AtomicInt (without synchronize) ?

@enebo
Copy link
Member

@enebo enebo commented Oct 24, 2019

with PR as it is globalInlineCount should be made an int. The usage of this synchronize was so narrow I don't think in practice we would ever see the field change while it is synched. That said, either suggested fix is better (I would prefer AtomicInt myself).

@kares kares merged commit 1908176 into jruby:master Oct 26, 2019
5 checks passed
@kares kares added this to the JRuby 9.2.9.0 milestone Oct 26, 2019
Sign up for free to 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.

None yet

3 participants