}
public static class ThreadMethods {
@JRubyMethod(name = "exclusive", meta = true, compat = RUBY1_8)
public static IRubyObject exclusive(ThreadContext context, IRubyObject receiver, Block block) {
ThreadService service = context.getRuntime().getThreadService();
boolean old = service.getCritical();
try {
service.setCritical(true);
return block.yield(receiver.getRuntime().getCurrentContext(), (IRubyObject) null);
} finally {
service.setCritical(old);
}
}