Add shared queue to AsynRPCQueue.
This commit is contained in:
parent
b922924d14
commit
423a63d0a9
|
@ -6,6 +6,15 @@
|
|||
|
||||
static std::atomic<size_t> workerCounter(0);
|
||||
|
||||
/**
|
||||
* Static method to return the shared/default queue.
|
||||
*/
|
||||
shared_ptr<AsyncRPCQueue> AsyncRPCQueue::sharedInstance() {
|
||||
// Thread-safe in C+11 and gcc 4.3
|
||||
static shared_ptr<AsyncRPCQueue> q = std::make_shared<AsyncRPCQueue>();
|
||||
return q;
|
||||
}
|
||||
|
||||
AsyncRPCQueue::AsyncRPCQueue() : closed_(false), finish_(false) {
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ typedef std::unordered_map<AsyncRPCOperationId, std::shared_ptr<AsyncRPCOperatio
|
|||
|
||||
class AsyncRPCQueue {
|
||||
public:
|
||||
static shared_ptr<AsyncRPCQueue> sharedInstance();
|
||||
|
||||
AsyncRPCQueue();
|
||||
virtual ~AsyncRPCQueue();
|
||||
|
||||
|
|
Loading…
Reference in New Issue