mirror of
https://github.com/tnodir/fort
synced 2024-11-15 13:16:11 +00:00
ControlWorker: Wait abort completion.
This commit is contained in:
parent
218407e248
commit
648a1e07cd
@ -16,7 +16,9 @@ ControlWorker::ControlWorker(QSystemSemaphore *semaphore,
|
|||||||
|
|
||||||
void ControlWorker::run()
|
void ControlWorker::run()
|
||||||
{
|
{
|
||||||
while (m_semaphore->acquire() && !m_aborted) {
|
QMutexLocker locker(&m_mutex);
|
||||||
|
|
||||||
|
while (!m_aborted && m_semaphore->acquire()) {
|
||||||
processRequest();
|
processRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,6 +28,8 @@ void ControlWorker::abort()
|
|||||||
m_aborted = true;
|
m_aborted = true;
|
||||||
|
|
||||||
m_semaphore->release();
|
m_semaphore->release();
|
||||||
|
|
||||||
|
m_mutex.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ControlWorker::post(const QString &scriptPath,
|
bool ControlWorker::post(const QString &scriptPath,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef CONTROLWORKER_H
|
#ifndef CONTROLWORKER_H
|
||||||
#define CONTROLWORKER_H
|
#define CONTROLWORKER_H
|
||||||
|
|
||||||
|
#include <QMutex>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
|
|
||||||
@ -44,6 +45,8 @@ private:
|
|||||||
|
|
||||||
QSystemSemaphore *m_semaphore;
|
QSystemSemaphore *m_semaphore;
|
||||||
QSharedMemory *m_sharedMemory;
|
QSharedMemory *m_sharedMemory;
|
||||||
|
|
||||||
|
QMutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONTROLWORKER_H
|
#endif // CONTROLWORKER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user