Dalibor Topic wrote:
Hi,

I've looked over Classpath's implementation of
synchronized* methods in java.util.Collections, and I
don't understand why the synchronized wrapper classes
sync on their own specific mutex field instead of
syncing on themselves?

i.e. why not have all the wrapper methods synchronized
and drop the mutex field? That's how kaffe does it.
They sync on the specified mutex so iterators (which are different instances) can sync on the same mutex. It is also essential for correctly implementing things like Map.subMap(), where the sub-map must synchronize on the original map.

--
This signature intentionally left boring.

Eric Blake [EMAIL PROTECTED]
BYU student, free software programmer




_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to