rubygems/rubygems — pull request #964 by tenderlove (2014-07-03 18:03:21+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.