0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::ctx: Spawn OLE thread lazily.

This commit is contained in:
Jason Volk 2018-02-07 11:37:11 -08:00
parent 9de8cb69d2
commit 353ee9b80d

View file

@ -969,7 +969,6 @@ ircd::ctx::ole::init::init()
{
assert(!thread);
interruption = false;
thread = new std::thread(&worker);
}
ircd::ctx::ole::init::~init()
@ -1028,6 +1027,9 @@ ircd::ctx::ole::offload(const std::function<void ()> &func)
void
ircd::ctx::ole::push(closure &&func)
{
if(unlikely(!thread))
thread = new std::thread(&worker);
const std::lock_guard<decltype(mutex)> lock(mutex);
queue.emplace_back(std::move(func));
cond.notify_one();