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