本文整理汇总了C++中VM::interrupt_with_signal方法的典型用法代码示例。如果您正苦于以下问题:C++ VM::interrupt_with_signal方法的具体用法?C++ VM::interrupt_with_signal怎么用?C++ VM::interrupt_with_signal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VM
的用法示例。
在下文中一共展示了VM::interrupt_with_signal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rb_thread_blocking_region
// THAR BE DRAGONS.
//
// When venturing through the valleys of the unmanaged, our hero must
// remain vigilant and disiplined! If she should ever find a VALUE for
// a reference in her travels: Look away! For these VALUEs are pure
// death! Our hero must steel herself and continue on her quest, returning
// as soon as possible to the castle of the managed.
VALUE rb_thread_blocking_region(rb_blocking_function_t func, void* data,
rb_unblock_function_t ubf, void* ubf_data) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
VM* state = env->state();
UnblockFuncWaiter waiter(ubf, ubf_data);
VALUE ret = Qnil;
if (ubf == RUBY_UBF_IO || ubf == RUBY_UBF_PROCESS) {
state->interrupt_with_signal();
} else {
state->install_waiter(waiter);
}
{
GlobalLock::UnlockGuard guard(env);
ret = (*func)(data);
}
state->clear_waiter();
return ret;
}