Skip to content

Is LockFreeBucket tryConsumeImpl Thread Safe? #157

Discussion options

You must be logged in to vote

@zhangchengkai826 hello,

JMM is the hardest part of java specification. Typically regular developer need to read it 10-20 times in combination with reading non-formal JMM explanations like this Java Memory Model Pragmatics and others.

Let's check the statement that reading in action T3 does not see the write that was made by action T0.
We have two thread A and B and four actions:

  • T0 in thread A - write to a field X of StateWithConfiguration.
  • T1 in thread A - the write of reference to StateWithConfiguration.
  • T2 in thread B - the read of reference to StateWithConfiguration.
  • T3 in thread B - read of a field X of StateWithConfiguration.

It worse to mention the following facts about the acti…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhangchengkai826
Comment options

Answer selected by zhangchengkai826
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants