worked on thread safety with tasks

This commit is contained in:
itsmattkc
2019-08-09 12:31:02 +10:00
parent c0f6ee534a
commit 1616166fbc
9 changed files with 137 additions and 27 deletions
+25
View File
@@ -0,0 +1,25 @@
#ifndef THREADEDOBJECT_H
#define THREADEDOBJECT_H
#include <QMutex>
class ThreadedObject
{
public:
ThreadedObject();
void LockMutex();
void UnlockMutex();
bool TryLockMutex(int timeout = 0);
void LockDeletes();
void UnlockDeletes();
bool AreDeletesLocked();
private:
QMutex threadobj_main_lock_;
QAtomicInt threadobj_delete_lock_;
};
#endif // THREADEDOBJECT_H