Added the thread safe TSQueue and using it in mainwindow to replace the adhoc queue implementation.
This commit is contained in:
parent
c551d982c6
commit
83064ab86b
10 changed files with 253 additions and 27 deletions
27
tsqueue.h
Normal file
27
tsqueue.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef TSQUEUE_H
|
||||
#define TSQUEUE_H
|
||||
|
||||
#include "Win32Event.h"
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
|
||||
class TSQueue {
|
||||
public:
|
||||
using t_Callable = std::function<void()>;
|
||||
|
||||
TSQueue();
|
||||
void add(t_Callable callable);
|
||||
bool empty();
|
||||
t_Callable pop();
|
||||
|
||||
HANDLE getNewDataEventHandle();
|
||||
private:
|
||||
using t_CallableQueue = std::deque<t_Callable>;
|
||||
|
||||
Win32Event newData;
|
||||
std::mutex m;
|
||||
t_CallableQueue futureQueue;
|
||||
};
|
||||
|
||||
#endif // TSQUEUE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue