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:
parent
9de8cb69d2
commit
353ee9b80d
1 changed files with 3 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue