本文整理汇总了C++中ExecutionContext::fiberInit方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecutionContext::fiberInit方法的具体用法?C++ ExecutionContext::fiberInit怎么用?C++ ExecutionContext::fiberInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext::fiberInit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
// FIBER THREAD
void run() {
// make local copy of m_function and m_params
if (m_async) {
try {
s_fiber_data->m_fiberThread = true;
ExecutionContext *context = g_context.getNoCheck();
if (context && m_context) {
context->fiberInit(m_context, m_refMap);
const VirtualHost *vhost = m_context->getVirtualHost();
if (vhost) {
VirtualHost::SetCurrent((VirtualHost *)vhost);
}
m_context = context; // switching role
}
AutoloadHandler *handler = AutoloadHandler::s_instance.get();
if (handler && m_autoload_handler) {
handler->fiberInit(m_autoload_handler, m_refMap);
m_autoload_handler = handler; // switching role
}
(m_evalState = Eval::RequestEvalState::Get())->
fiberInit(m_unmarshaled_evalState, m_refMap);
m_function = m_function.fiberMarshal(m_refMap);
m_params = m_params.fiberMarshal(m_refMap);
ThreadInfo::s_threadInfo->m_globals =
m_global_variables = get_global_variables();
fiber_marshal_global_state(m_global_variables,
m_unmarshaled_global_variables, m_refMap);
} catch (const Exception &e) {
m_fatal = String(e.getMessage());
} catch (...) {
m_fatal = String("unknown exception was thrown");
}
Lock lock(this);
m_ready = true;
notify();
}
if (m_fatal.isNull()) {
try {
m_return = f_call_user_func_array(m_function, m_params);
} catch (const ExitException &e) {
m_exit = true;
} catch (const Exception &e) {
m_fatal = String(e.getMessage());
} catch (Object e) {
m_exception = e;
} catch (...) {
m_fatal = String("unknown exception was thrown");
}
}
{
Lock lock(this);
m_done = true;
notify();
}
{
Lock lock(m_thread);
m_thread->notify();
}
}