rbd-mirror: spawn replayer thread

Also, wait for it to finish only if it has been started.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
This commit is contained in:
Mykola Golub 2016-03-06 16:12:03 +02:00
parent ed035a3bf3
commit 803eb511dc

View File

@ -37,7 +37,9 @@ Replayer::~Replayer()
Mutex::Locker l(m_lock);
m_cond.Signal();
}
m_replayer_thread.join();
if (m_replayer_thread.is_started()) {
m_replayer_thread.join();
}
}
int Replayer::init()
@ -81,6 +83,8 @@ int Replayer::init()
m_pool_watcher.reset(new PoolWatcher(m_remote, 30, m_lock, m_cond));
m_pool_watcher->refresh_images();
m_replayer_thread.create("replayer");
return 0;
}