#include "HxThread.h" HxThread::HxThread(int millisecond) { m_wait_time = millisecond; } void HxThread::stop() { m_thread_status = false; while (!m_stop_flags) msleep(100); } void HxThread::sleep(int millisecond) { auto time = QTime::currentTime().addMSecs(millisecond); while( QTime::currentTime() < time ) QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } void HxThread::action() { } void HxThread::continue_with(){} void HxThread::run() { m_stop_flags = false; m_thread_status = true; while (m_thread_status) { action(); msleep(m_wait_time); } /* Execution at completion */ continue_with(); m_stop_flags = true; }