From 861513a01fdb2569bb6fba4750994120582370e6 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 22 Aug 2016 09:16:01 -0700 Subject: [PATCH] Add public method to AsycnRPCQueue to retrieve all the known operation ids. --- src/asyncrpcqueue.cpp | 10 ++++++++++ src/asyncrpcqueue.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/asyncrpcqueue.cpp b/src/asyncrpcqueue.cpp index 679f861c5..4cc9336c7 100644 --- a/src/asyncrpcqueue.cpp +++ b/src/asyncrpcqueue.cpp @@ -145,3 +145,13 @@ void AsyncRPCQueue::addWorker() { int AsyncRPCQueue::getNumberOfWorkers() { return workers.size(); } + + +std::vector AsyncRPCQueue::getAllOperationIds() { + std::unique_lock< std::mutex > guard(cs_lock); + std::vector v; + for(auto & entry: operationMap) + v.push_back(entry.first); + return v; +} + diff --git a/src/asyncrpcqueue.h b/src/asyncrpcqueue.h index 99ba45f91..f86c4f848 100644 --- a/src/asyncrpcqueue.h +++ b/src/asyncrpcqueue.h @@ -43,6 +43,7 @@ public: std::shared_ptr getOperationForId(AsyncRPCOperationId); std::shared_ptr popOperationForId(AsyncRPCOperationId); void addOperation(const std::shared_ptr &ptrOperation); + std::vector getAllOperationIds(); private: // addWorker() will spawn a new thread on this method