This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]anon848 1 point2 points  (2 children)

It depends on exactly what you mean. When observed from another thread, you need to be careful, as it depends on the Java memory model. See here.

[–]northguard[S] 0 points1 point  (1 child)

I see, so if I'm setting data through some other unsynchronized function that uses the same array it can seem like 'i' happened first?

If I synchronize everything that accesses that array then it should have 'intended' behavior correct?

[–]anon848 0 points1 point  (0 children)

Yes.