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; }
void *FiberBase::fiber_proc(void *p) { Isolate &isolate = Isolate::now(); v8::Locker locker(isolate.isolate); v8::Isolate::Scope isolate_scope(isolate.isolate); v8::HandleScope handle_scope(isolate.isolate); v8::Context::Scope context_scope( v8::Local<v8::Context>::New(isolate.isolate, isolate.s_context)); while (1) { asyncEvent *ae; if ((ae = g_jobs.tryget()) == NULL) { s_idleFibers ++; if (s_idleFibers > MAX_IDLE) { s_idleFibers --; break; } v8::Unlocker unlocker(isolate.isolate); ae = g_jobs.get(); s_idleFibers --; } { v8::HandleScope handle_scope(isolate.isolate); ae->js_callback(); } } s_fibers --; return NULL; }