Setup locking around Process.kill process
Setup locking around Process.kill process

This fixes a potential race that could occur in this subprocess. The
problem is that when two signals were received at the same time, there
was a race condition.

What could happen is that when two signals were received, it would run
the signal handler twice. One handler could set signaled to true, the
other one would see signaled as false and exit before the other handler
would print the "signaled" string.

With a Mutex we can use try_lock to attempt to lock once and then exit.
This makes sure we only print "signaled" once and immediately exit.

Why not use Mutex.synchronize {} one might ask here. Well, that doesn't
work since signals are handled in the same thread, so what happens then
is that you can recursive locking errors since the Mutex is locked twice
in the same thread so the deadlock detection kicks in and causes an
exception.

mrkn/rubyspec,DavidEGrayson/rubyspec,amarshall/rubyspec,jannishuebl/rubyspec,nevir/rubyspec,scooter-dangle/rubyspec,JuanitoFatas/rubyspec,iainbeeston/rubyspec,ericmeyer/rubyspec,nobu/rubyspec,teleological/rubyspec,sgarciac/spec,wied03/rubyspec,flavio/rubyspec,sferik/rubyspec,sgarciac/spec,jstepien/rubyspec,askl56/rubyspec,Aesthetikx/rubyspec,ruby/spec,kachick/rubyspec,markburns/rubyspec,markburns/rubyspec,agrimm/rubyspec,DavidEGrayson/rubyspec,eregon/rubyspec,kachick/rubyspec,ruby/spec,jstepien/rubyspec,Aesthetikx/rubyspec,yaauie/rubyspec,nobu/rubyspec,saturnflyer/rubyspec,nevir/rubyspec,jannishuebl/rubyspec,scooter-dangle/rubyspec,benlovell/rubyspec,wied03/rubyspec,yous/rubyspec,benlovell/rubyspec,lucaspinto/rubyspec,yb66/rubyspec,atambo/rubyspec,ruby/rubyspec,sgarciac/spec,agrimm/rubyspec,yb66/rubyspec,BanzaiMan/rubyspec,yous/rubyspec,lucaspinto/rubyspec,chesterbr/rubyspec,jvshahid/rubyspec,jvshahid/rubyspec,alexch/rubyspec,iliabylich/rubyspec,BanzaiMan/rubyspec,iliabylich/rubyspec,wied03/rubyspec,bomatson/rubyspec,shirosaki/rubyspec,mbj/rubyspec,ericmeyer/rubyspec,nobu/rubyspec,DawidJanczak/rubyspec,bomatson/rubyspec,alexch/rubyspec,sferik/rubyspec,amarshall/rubyspec,shirosaki/rubyspec,DawidJanczak/rubyspec,atambo/rubyspec,ruby/spec,teleological/rubyspec,kachick/rubyspec,kidaa/rubyspec,mbj/rubyspec,bl4ckdu5t/rubyspec,askl56/rubyspec,mrkn/rubyspec,chesterbr/rubyspec,yaauie/rubyspec,iainbeeston/rubyspec,josedonizetti/rubyspec,JuanitoFatas/rubyspec,eregon/rubyspec,flavio/rubyspec,bl4ckdu5t/rubyspec,eregon/rubyspec,kidaa/rubyspec,saturnflyer/rubyspec,josedonizetti/rubyspec,ruby/rubyspec