Port of thread_safe to RubyMotion.