mirror of https://github.com/AxioDL/jbus.git
Merge pull request #7 from lioncash/assignment
Listener: Simplify assignment within accept()
This commit is contained in:
commit
fb3d880b63
|
@ -68,7 +68,7 @@ void Listener::listenerProc() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (acceptData && acceptClock) {
|
if (acceptData && acceptClock) {
|
||||||
std::unique_lock<std::mutex> lk(m_queueLock);
|
std::unique_lock lk{m_queueLock};
|
||||||
m_endpointQueue.push(std::make_unique<Endpoint>(0, std::move(acceptData), std::move(acceptClock)));
|
m_endpointQueue.push(std::make_unique<Endpoint>(0, std::move(acceptData), std::move(acceptClock)));
|
||||||
}
|
}
|
||||||
WaitGCTicks(GetGCTicksPerSec());
|
WaitGCTicks(GetGCTicksPerSec());
|
||||||
|
@ -94,14 +94,14 @@ void Listener::stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Endpoint> Listener::accept() {
|
std::unique_ptr<Endpoint> Listener::accept() {
|
||||||
std::unique_lock<std::mutex> lk(m_queueLock);
|
std::unique_lock lk{m_queueLock};
|
||||||
if (m_endpointQueue.size()) {
|
if (m_endpointQueue.empty()) {
|
||||||
std::unique_ptr<Endpoint> ret;
|
return nullptr;
|
||||||
ret = std::move(m_endpointQueue.front());
|
|
||||||
m_endpointQueue.pop();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
return {};
|
|
||||||
|
auto ret = std::move(m_endpointQueue.front());
|
||||||
|
m_endpointQueue.pop();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Listener::Listener() = default;
|
Listener::Listener() = default;
|
||||||
|
|
Loading…
Reference in New Issue