bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/36876] New: HashMap and Hashtable fields missing volatile


From: l dot hellyer at kent dot ac dot uk
Subject: [Bug classpath/36876] New: HashMap and Hashtable fields missing volatile declaration
Date: 19 Jul 2008 17:19:37 -0000

Hi,

Reviewing the code for java.util.HashMap and java.util.Hashtable it struck me
that the field modCount should be declared volatile - otherwise a update of the
field by another thread might not detected due to a lack of a suitable memory
barrier.

This apparent omission came to light when comparing the number of classes
containing volatile fields between openjdk and classpath.  Java-6-openjdk
contains 151 classes that contain or extend a class with a volatile field. 
Classpath 0.97.2 contains only 26 classes that contain a volatile field (0
classes extend a class containing a volatile field).  FYI the modCount field in
openjdk's HashMap (that performs the same purpose) is declared volatile.


-- 
           Summary: HashMap and Hashtable fields missing volatile
                    declaration
           Product: classpath
           Version: 0.97.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: l dot hellyer at kent dot ac dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36876





reply via email to

[Prev in Thread] Current Thread [Next in Thread]