using ring buffer

main
Benjamin Kraft 2 years ago
parent 069f5f4bcf
commit c7986e6bc0
  1. 6
      src/Queue.h

@ -9,7 +9,7 @@
#include <mutex>
#include <unordered_set>
#define MAX_QUEUE_SIZE 10
#define MAX_QUEUE_SIZE 100
template<typename T>
class Queue {
@ -36,7 +36,9 @@ protected:
return tail == head;
}
size_t size() const {
return container.size();
if (tail > head)
return tail - head;
return MAX_QUEUE_SIZE - head + tail;
}
T * pop(){
mutex.lock();

Loading…
Cancel
Save