Add public method to AsycnRPCQueue to retrieve all the known operation ids.

This commit is contained in:
Simon 2016-08-22 09:16:01 -07:00
parent c72a427274
commit 861513a01f
2 changed files with 11 additions and 0 deletions

View File

@ -145,3 +145,13 @@ void AsyncRPCQueue::addWorker() {
int AsyncRPCQueue::getNumberOfWorkers() {
return workers.size();
}
std::vector<AsyncRPCOperationId> AsyncRPCQueue::getAllOperationIds() {
std::unique_lock< std::mutex > guard(cs_lock);
std::vector<AsyncRPCOperationId> v;
for(auto & entry: operationMap)
v.push_back(entry.first);
return v;
}

View File

@ -43,6 +43,7 @@ public:
std::shared_ptr<AsyncRPCOperation> getOperationForId(AsyncRPCOperationId);
std::shared_ptr<AsyncRPCOperation> popOperationForId(AsyncRPCOperationId);
void addOperation(const std::shared_ptr<AsyncRPCOperation> &ptrOperation);
std::vector<AsyncRPCOperationId> getAllOperationIds();
private:
// addWorker() will spawn a new thread on this method