diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index d4f4d3499..d1a08996c 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -359,7 +359,13 @@ spdk_init_thread_poll(void *arg) pthread_mutex_lock(&g_init_mtx); if (!TAILQ_EMPTY(&g_threads)) { TAILQ_FOREACH_SAFE(thread, &g_threads, link, tmp) { - spdk_fio_poll_thread(thread); + if (spdk_thread_is_exited(thread->thread)) { + TAILQ_REMOVE(&g_threads, thread, link); + free(thread->iocq); + spdk_thread_destroy(thread->thread); + } else { + spdk_fio_poll_thread(thread); + } } /* If there are exiting threads to poll, don't sleep. */