|
|
@ -17,7 +17,7 @@ class Queue { |
|
|
|
std::mutex mutex; |
|
|
|
std::mutex mutex; |
|
|
|
void run() { |
|
|
|
void run() { |
|
|
|
while (!QApplication::closingDown()){ |
|
|
|
while (!QApplication::closingDown()){ |
|
|
|
if (!isEmpty()) |
|
|
|
if (tail != head) |
|
|
|
update(); |
|
|
|
update(); |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1)); |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1)); |
|
|
|
} |
|
|
|
} |
|
|
@ -29,9 +29,6 @@ class Queue { |
|
|
|
size_t head = 0; |
|
|
|
size_t head = 0; |
|
|
|
T * container[MAX_QUEUE_SIZE]; |
|
|
|
T * container[MAX_QUEUE_SIZE]; |
|
|
|
protected: |
|
|
|
protected: |
|
|
|
bool isEmpty() const { |
|
|
|
|
|
|
|
return tail == head; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
T * pop(){ |
|
|
|
T * pop(){ |
|
|
|
mutex.lock(); |
|
|
|
mutex.lock(); |
|
|
|
T * element = container[head]; |
|
|
|
T * element = container[head]; |
|
|
|