-
Mehmet Emin INAC authored
Since the Ruby threads are preemptive on the user level, the scheduler can decide to do the context switching to give the execution to another thread after the conditional check. If this happens, two threads will generate the exact same object. We can avoid this by just synchronizing the whole block. Since the `Mutex` is not `reentrant` in Ruby, I've also changed the way we synchronize the critical section with `Monitor`.
f1c6772e