frsyuki/serverengine — pull request #7 by sonots (2013-09-08 06:25:32+00:00)
Title: mutex `unlock`: cannot be called from trap context

Related with https://github.com/fluent/fluentd/pull/191. Since Ruby 2.0.0, We can't synchronize mutex in trap context.
There is another pull request https://github.com/frsyuki/serverengine/pull/5, but this fix looks better.

With fix https://github.com/frsyuki/serverengine/pull/6, the number of errors were reduced into 3.

1) ServerEngine::MultiWorkerServer scale up
Failure/Error: test_state(:worker_run).should == 3
expected: 3
got: 5 (using ==)
# ./spec/multi_process_server_spec.rb:22:in `block (3 levels) in '

2) ServerEngine::MultiWorkerServer scale down
Failure/Error: test_state(:worker_stop).should == 2
expected: 2
got: 1 (using ==)
# ./spec/multi_process_server_spec.rb:50:in `block (3 levels) in '

3) ServerEngine::SignalThread call handler
Failure/Error: n.should == 1
expected: 1
got: 0 (using ==)
# ./spec/signal_thread_spec.rb:21:in `block (2 levels) in '