本文整理汇总了C++中VM::become_unmanaged方法的典型用法代码示例。如果您正苦于以下问题:C++ VM::become_unmanaged方法的具体用法?C++ VM::become_unmanaged怎么用?C++ VM::become_unmanaged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VM
的用法示例。
在下文中一共展示了VM::become_unmanaged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void* Thread::run(void* ptr) {
VM* vm = reinterpret_cast<VM*>(ptr);
State state_obj(vm), *state = &state_obj;
vm->set_stack_bounds(THREAD_STACK_SIZE);
vm->set_current_thread();
RUBINIUS_THREAD_START(
const_cast<RBX_DTRACE_CHAR_P>(vm->name().c_str()), vm->thread_id(), 0);
vm->thread->pid(state, Fixnum::from(gettid()));
logger::write("start thread: %s, %d, %#x",
vm->name().c_str(), vm->thread->pid()->to_native(),
(unsigned int)thread_debug_self());
NativeMethod::init_thread(state);
state->vm()->become_managed();
vm->shared.tool_broker()->thread_start(state);
Object* value = vm->thread->function()(state);
vm->set_call_frame(NULL);
vm->shared.tool_broker()->thread_stop(state);
vm->thread->join_lock_.lock();
vm->thread->stopped();
memory::LockedObjects& locked_objects = state->vm()->locked_objects();
for(memory::LockedObjects::iterator i = locked_objects.begin();
i != locked_objects.end();
++i)
{
(*i)->unlock_for_terminate(state);
}
locked_objects.clear();
vm->thread->join_cond_.broadcast();
vm->thread->join_lock_.unlock();
NativeMethod::cleanup_thread(state);
logger::write("exit thread: %s", vm->name().c_str());
vm->become_unmanaged();
if(vm->main_thread_p() || (!value && vm->thread_state()->raise_reason() == cExit)) {
state->shared().signals()->system_exit(vm->thread_state()->raise_value());
}
vm->set_zombie(state);
RUBINIUS_THREAD_STOP(
const_cast<RBX_DTRACE_CHAR_P>(vm->name().c_str()), vm->thread_id(), 0);
return 0;
}