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.
Merge pull request #967 from tenderlove/thread_safe_gem

lock around spec activation so that `gem` is threadsafe.