output/httpd: use std::lock_guard
This commit is contained in:
parent
f7af1bb8e2
commit
72146e7800
@ -325,9 +325,10 @@ HttpdOutput::BroadcastPage(PagePtr page)
|
|||||||
{
|
{
|
||||||
assert(page != nullptr);
|
assert(page != nullptr);
|
||||||
|
|
||||||
mutex.lock();
|
{
|
||||||
pages.emplace(std::move(page));
|
const std::lock_guard<Mutex> lock(mutex);
|
||||||
mutex.unlock();
|
pages.emplace(std::move(page));
|
||||||
|
}
|
||||||
|
|
||||||
DeferredMonitor::Schedule();
|
DeferredMonitor::Schedule();
|
||||||
}
|
}
|
||||||
@ -336,15 +337,15 @@ void
|
|||||||
HttpdOutput::BroadcastFromEncoder()
|
HttpdOutput::BroadcastFromEncoder()
|
||||||
{
|
{
|
||||||
/* synchronize with the IOThread */
|
/* synchronize with the IOThread */
|
||||||
mutex.lock();
|
{
|
||||||
while (!pages.empty())
|
const std::lock_guard<Mutex> lock(mutex);
|
||||||
cond.wait(mutex);
|
while (!pages.empty())
|
||||||
|
cond.wait(mutex);
|
||||||
|
|
||||||
PagePtr page;
|
PagePtr page;
|
||||||
while ((page = ReadPage()) != nullptr)
|
while ((page = ReadPage()) != nullptr)
|
||||||
pages.push(page);
|
pages.push(page);
|
||||||
|
}
|
||||||
mutex.unlock();
|
|
||||||
|
|
||||||
DeferredMonitor::Schedule();
|
DeferredMonitor::Schedule();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user