void *FiberBase::fiber_proc(void *p) { Isolate* isolate = (Isolate*)p; Runtime rt; rt.m_pDateCache = &isolate->m_dc; Runtime::reg(&rt); v8::Locker locker(isolate->m_isolate); v8::Isolate::Scope isolate_scope(isolate->m_isolate); v8::HandleScope handle_scope(isolate->m_isolate); v8::Context::Scope context_scope( v8::Local<v8::Context>::New(isolate->m_isolate, isolate->m_context)); isolate->m_idleFibers --; while (1) { AsyncEvent *ae; if ((ae = (AsyncEvent*)isolate->m_jobs.tryget()) == NULL) { isolate->m_idleFibers ++; if (isolate->m_idleFibers > g_spareFibers) { isolate->m_idleFibers --; break; } { v8::Unlocker unlocker(isolate->m_isolate); ae = (AsyncEvent*)isolate->m_jobs.get(); } isolate->m_idleFibers --; } { v8::HandleScope handle_scope(isolate->m_isolate); ae->js_invoke(); } } isolate->m_currentFibers --; return NULL; }
void *FiberBase::fiber_proc(void *p) { Isolate* isolate = Isolate::now(); v8::Locker locker(isolate->m_isolate); v8::Isolate::Scope isolate_scope(isolate->m_isolate); v8::HandleScope handle_scope(isolate->m_isolate); v8::Context::Scope context_scope( v8::Local<v8::Context>::New(isolate->m_isolate, isolate->m_context)); s_idleFibers --; while (1) { AsyncEvent *ae; if ((ae = g_jobs.tryget()) == NULL) { s_idleFibers ++; if (s_idleFibers > g_spareFibers) { s_idleFibers --; break; } { v8::Unlocker unlocker(isolate->m_isolate); ae = g_jobs.get(); } s_idleFibers --; } { v8::HandleScope handle_scope(isolate->m_isolate); ae->js_invoke(); } } s_fibers --; return NULL; }