Avoid mutex from trap context Ruby2

Simple hack to avoid `'lock': can't be called from trap context (ThreadError)` appearing on Ruby2.