new java.util.BitSet and Synchronization

Parmelan, Edouard EP510777 at exchange.FRANCE.NCR.com
Tue Oct 20 06:53:07 PDT 1998


Hi Godmar,

This is the optimized version of java.util.BitSet.

I use an array of long, so hashCode() and Serialization
are as JDK1.2 spec.

It leave a synchronization problem for methods equals(),
and()... : they need a lock on two BitSet, this and the parameter.

The problem is a possible dead lock, and I don't know how to workaround:

Imagine two BitSet a and b, and two threads t1 and t2.
t1 executes a.equals(b)
t2 executes b.equals(a)

equals() should lock a and b in the same order for the two threads
but I don't know how to check the order :(

Have you ideas ?
Thanks in advance,
Edouard.
----
 <<BitSet.java.gz>> 


 a.equals(b) and b.equals(a)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: BitSet.java.gz
Type: application/octet-stream
Size: 2356 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/19981020/d882f545/attachment-0006.obj 


More information about the kaffe mailing list