MXS-2004 Replace THREAD with std::thread in Worker

This commit is contained in:
Johan Wikman
2018-08-10 13:22:47 +03:00
parent 6db03d4b29
commit 47b53aae55
4 changed files with 29 additions and 17 deletions

View File

@ -146,8 +146,15 @@ bool Housekeeper::start()
sem_init(&res.sem, 0, 0);
res.ok = false;
hk->m_thread = std::thread(hkthread, &res);
sem_wait(&res.sem);
try
{
hk->m_thread = std::thread(hkthread, &res);
sem_wait(&res.sem);
}
catch (const std::exception& x)
{
MXS_ERROR("Could not start housekeeping thread: %s", x.what());
}
sem_destroy(&res.sem);
return res.ok;