#ifndef DATAQUEUE_H #define DATAQUEUE_H #include #include #include #include "libsearch_global.h" namespace Zeeker { // TODO I want a unlocked queue template class LIBSEARCH_EXPORT DataQueue : public QList { public: inline void enqueue(const T &t) { QMutexLocker locker(&m_mutex); QList::append(t); } inline T dequeue() { QMutexLocker locker(&m_mutex); return QList::takeFirst(); } inline void clear() { QMutexLocker locker(&m_mutex); QList::clear(); return; } inline bool isEmpty() { QMutexLocker locker(&m_mutex); return QList::isEmpty(); } private: QMutex m_mutex; }; } #endif // DATAQUEUE_H