pgLab/pglab/tsqueue.h
Eelke Klein 4167c483f5 Most seems to work. Multi threading is not optimal
however some points use a timeout with select or wait_for
to poll a condition at the same time.
2017-08-23 17:41:10 +02:00

28 lines
522 B
C++

#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(); Looks like this wasn't use at all so we can leave the event out.
private:
using t_CallableQueue = std::deque<t_Callable>;
//Win32Event newData;
std::mutex m;
t_CallableQueue futureQueue;
};
#endif // TSQUEUE_H