C++ (Qt)void Thread::step(){ if (!m_printed) { m_printed = true; qDebug() << "step()" << QThread::currentThreadId(); }} void Thread::run(){ qDebug() << "run()" << QThread::currentThreadId(); m_printed = false; QTimer idle; connect(&idle, &QTimer::timeout, this, &Thread::step); idle.start(1); QThread::run();}
C++ (Qt)setInterval( 1 );start();
C++ (Qt)void QThread::run(){ (void) exec();}