diff --git a/include/spdk/thread.h b/include/spdk/thread.h index ca895f673..deea20c30 100644 --- a/include/spdk/thread.h +++ b/include/spdk/thread.h @@ -232,6 +232,15 @@ void spdk_set_thread(struct spdk_thread *thread); */ void spdk_thread_exit(struct spdk_thread *thread); +/** + * Returns whether the thread is marked as exited. + * + * \param thread The thread to query. + * + * \return true if marked as exited, false otherwise. + */ +bool spdk_thread_is_exited(struct spdk_thread *thread); + /** * Destroy a thread, releasing all of its resources. May only be called * on a thread previously marked as exited. diff --git a/lib/thread/thread.c b/lib/thread/thread.c index 0839615cd..78c1c1558 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -355,6 +355,12 @@ spdk_thread_exit(struct spdk_thread *thread) thread->exit = true; } +bool +spdk_thread_is_exited(struct spdk_thread *thread) +{ + return thread->exit; +} + void spdk_thread_destroy(struct spdk_thread *thread) {