Beispiel #1
0
    virtual void Run()
    {
        Isolate* isolate = s_isolates.head();
        intptr_t lastTimes = isolate->m_service->m_switchTimes;
        int32_t cnt = 0;

        while (true)
        {
            sleep(100);

            if (isolate->m_service->m_resume.empty())
            {
                cnt = 0;
                continue;
            }

            if (lastTimes != isolate->m_service->m_switchTimes)
            {
                cnt = 0;
                lastTimes = isolate->m_service->m_switchTimes;
                continue;
            }

            cnt ++;
            if (cnt == 2)
            {
                cnt = 0;
                isolate->m_isolate->RequestInterrupt(InterruptCallback, NULL);
            }
        }
    }
Beispiel #2
0
void on_break(int32_t s) {
    puts("");

    static bool s_double = false;
    if (s_double)
    {
        puts("User interrupt.");

#ifdef DEBUG
        dump_memory(0);
#endif

        _exit(1);
    }
    s_double = true;

#ifdef WIN32
    exlib::OSThread _thread;
    _thread.bindCurrent();
#endif

    Isolate *p = s_isolates.head();
    while (p != 0) {
        p->m_isolate->RequestInterrupt(cb_interrupt, NULL);
        p->m_interrupt = true;
        // p->RequestInterrupt(InterruptCallbackEx);

        p = s_isolates.next(p);
    }
}
Beispiel #3
0
void Isolate::Unref(int32_t hr)
{
    if (s_iso_ref.dec() == 0) {
        Isolate* isolate = s_isolates.head();
        isolate->m_hr = hr;
        syncCall(isolate, syncExit, isolate);
    }
}