lib/thread: Add API to check if the thread is marked as exited

Add spdk_thread_is_exited() to check if the thread is marked as
exited.  This API will be used by reactor to destroy the thread
which exited voluntarily.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2086984b7813e8a1f401852fde7ab263bcf8ef60
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/481
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2020-01-27 20:01:52 -05:00 committed by Tomasz Zawadzki
parent 2be78638d4
commit 644e6420d1
2 changed files with 15 additions and 0 deletions

View File

@ -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.

View File

@ -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)
{