Hello,
let's look for the following piece of code:
c = new ConcurrentHashMap<Integer, Boolean>();
T1:
c.put(1, true);
for (Boolean b : c.values()) {
print(b);
}
T2:
c.put(2, true);
for (Boolean b : c.values()) {
print(b);
}
Is it guaranteed by JMM that any thread (T1 or T2) prints true, true?
To put it in another way, is it guaranteed that T1 or T2 observes both c.put
?
If yes / no, why?
Thanks in advance for your time.
--
You received this message because you are subscribed to the Google Groups
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/mechanical-sympathy/0945e8e3-1070-4166-b269-1c4e6c49da3en%40googlegroups.com.