Esempio n. 1
0
void Highlighter::start()
{
	if (refCount() > 0) {
		keepAlive_->release();
		incRefCount(); // prevent self destruction while running
	}
	ThreadFactory factory;
	factory.setStackSize(1*1024*1024); // HACK, limit should be user-configurable
	factory.start(this);
	started_ = true;
}
XPLM_API void
XPLMRegisterFlightLoopCallback(XPLMFlightLoop_f inFlightLoop, float inInterval, void* inRefcon) {

    ThreadFactory* f = new ThreadFactory(inFlightLoop, inInterval, inRefcon);

    for (int i = 0; i < THREADCNT; i++) {
        if (!threads[i]) {
            threads[i] = f;
            f->start();
            return;
        }
    }

    assert(false && "thread callback overflow");
}