torkell: (Default)
Thomas ([personal profile] torkell) wrote2011-07-21 11:21 pm
Entry tags:

(no subject)

The Java HashMap class is not synchronised (and that is explicitly documented). This results in... interesting behaviour if two or more threads try to modify a HashMap at the same time.

Apparently, one of the failure modes is for the put() method to get stuck in an infinite loop.

[identity profile] olego.livejournal.com 2011-07-22 02:06 am (UTC)(link)
It's easier in C++: since nothing is synchronised, you shouldn't be surprised when you get strange multi-threaded behaviour. That's why we use tons of locks.