thread: add spdk_thread_has_pollers()

This function add possibility to check if there are registered pollers
on particular thread.

Change-Id: I80af06a10c5c1b54fed5bb28a3aa769a52d8a206
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/446624
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Tomasz Zawadzki 2019-03-01 09:13:38 -05:00 committed by Darek Stojaczyk
parent 4680db9e09
commit 7173e9bd02
3 changed files with 26 additions and 0 deletions

View File

@ -12,6 +12,11 @@ spdk_nvme_probe_poll_async() were added to enable this feature.
Added new strip_size_kb rpc param on create to replace the more ambiguous
strip_size. The strip_size rpc param is deprecated.
### thread
Added spdk_thread_has_pollers() function to verify if there are
any registered pollers to be run on the thread.
## v19.01:
### ocf bdev

View File

@ -267,6 +267,16 @@ uint64_t spdk_thread_next_poller_expiration(struct spdk_thread *thread);
*/
int spdk_thread_has_active_pollers(struct spdk_thread *thread);
/**
* Returns whether there are any pollers registered to be run
* on the thread.
*
* \param thread The thread to check.
*
* \return true if there is any active poller, false otherwise.
*/
bool spdk_thread_has_pollers(struct spdk_thread *thread);
/**
* Get count of allocated threads.
*/

View File

@ -549,6 +549,17 @@ spdk_thread_has_active_pollers(struct spdk_thread *thread)
return !TAILQ_EMPTY(&thread->active_pollers);
}
bool
spdk_thread_has_pollers(struct spdk_thread *thread)
{
if (TAILQ_EMPTY(&thread->active_pollers) &&
TAILQ_EMPTY(&thread->timer_pollers)) {
return false;
}
return true;
}
uint32_t
spdk_thread_get_count(void)
{