exapmle/nvmf: Destroy dynamically exited thread at nvmf_reactor_run()

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6782e8c59df5f20cb6c368482633875d6e9b7235
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2538
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-05-20 06:49:42 +09:00 committed by Tomasz Zawadzki
parent 8753fdb645
commit 2a6ce9e2ce

View File

@ -198,8 +198,15 @@ nvmf_reactor_run(void *arg)
spdk_thread_poll(thread, 0, 0);
pthread_mutex_lock(&nvmf_reactor->mutex);
TAILQ_INSERT_TAIL(&nvmf_reactor->threads, lw_thread, link);
if (spdk_unlikely(spdk_thread_is_exited(thread) &&
spdk_thread_is_idle(thread))) {
spdk_thread_destroy(thread);
pthread_mutex_lock(&nvmf_reactor->mutex);
} else {
pthread_mutex_lock(&nvmf_reactor->mutex);
TAILQ_INSERT_TAIL(&nvmf_reactor->threads, lw_thread, link);
}
}
pthread_mutex_unlock(&nvmf_reactor->mutex);
} while (!g_reactors_exit);