I also feel that there is a good chance for race condition here. Is it an overkill to introduce [atomic](http://rubygems.org/gems/atomic) here?