Reading from a hash table while there are updates happening is not thread safe.
Ah I see what you mean, should we move the @lock.synchronise
call into get
instead?
I'm not sure we'd need it in set
anymore after that?
You need it in both methods because you are reading and writing to @constants
. You can't have synchronised access to the same hash table in any sitautions. Read only operations are not safe with simultaneous writes.
Alright, I merged a change to wrap the @constants
in a synchronize.
Thanks, @ioquatix for the inspiration!