rubygems/rubygems — pull request #967 by tenderlove (2014-07-07 15:27:20+00:00)
Title: lock around spec activation so that `gem` is threadsafe.

This program demonstrates the thread unsafetyness before this commit:

```ruby
require 'rubygems'

lp = $LOAD_PATH.dup

10.times.map {
Thread.new {
gem 'minitest'
}
}.each(&:join)

p $LOAD_PATH - lp
```

if you run this with JRuby, you will sometimes see multiple entries for
minitest on the load path. This commit fixes the `gem` method so that
you can call `gem` in parallel and the load path is updated safely.