JavaMemoryModel: Volatile array references

From: David Holmes (dholmes@dltech.com.au)
Date: Tue Apr 30 2002 - 22:51:00 EDT


In the proposed model does the strengthening of volatile give the effect of
having volatile array elements when accessed via a volatile array reference?

That is, given:

volatile int[] array = new int[n];

Thread 1: Thread 2:

 array[0] = 10;
                         int x = array[0];

Is x guaranteed to be 10?

David Holmes

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:39 EDT