July 26, 2009

 

[Java] The difference between volatile and synchronized

Quote from java.util.concurrenct package docs:

A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking.

Labels: , , ,

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?