MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Get

Method Get

phxqueue/comm/notifierpool.cpp:103–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103unique_ptr<Notifier> NotifierPool::Get() {
104 lock_guard<mutex> lock_guard(impl_->lock);
105
106 unique_ptr<Notifier> notifier = nullptr;
107 if (!impl_->notifiers.empty()) {
108 notifier = move(impl_->notifiers.front());
109 impl_->notifiers.pop();
110
111 } else {
112 notifier.reset(new Notifier());
113 if (!notifier->Init()) notifier = nullptr;
114 }
115 assert(notifier != nullptr);
116
117 return notifier;
118}
119
120void NotifierPool::Put(unique_ptr<Notifier> &notifier) {
121 lock_guard<mutex> lock_guard(impl_->lock);

Callers

nothing calls this directly

Calls 1

InitMethod · 0.45

Tested by

no test coverage detected