Added the ability to block on getMessages until a message arrives

This commit is contained in:
Paul Hollinsky
2018-11-09 16:28:48 -05:00
parent 35bd5139b2
commit 77d694c662
5 changed files with 22 additions and 12 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ public:
void enableMessagePolling();
bool disableMessagePolling();
std::vector<std::shared_ptr<Message>> getMessages();
bool getMessages(std::vector<std::shared_ptr<Message>>& container, size_t limit = 0);
bool getMessages(std::vector<std::shared_ptr<Message>>& container, size_t limit = 0, std::chrono::milliseconds timeout = std::chrono::milliseconds(0));
size_t getCurrentMessageCount() { return pollingContainer.size_approx(); }
size_t getPollingMessageLimit() { return pollingMessageLimit; }
void setPollingMessageLimit(size_t newSize) {
@@ -145,7 +145,7 @@ private:
void updateLEDState();
size_t pollingMessageLimit = 20000;
moodycamel::ConcurrentQueue<std::shared_ptr<Message>> pollingContainer;
moodycamel::BlockingConcurrentQueue<std::shared_ptr<Message>> pollingContainer;
void enforcePollingMessageLimit();
};