Commit d268b944 authored by Anisa Su's avatar Anisa Su Committed by Konrad Sztyber
Browse files

examples: remove unnecessary thread_is_idle check in nvmf and thread_ex



Related to GitHub issue #3545. Checking spdk_thread_is_idle before
spdk_thread_destroy may cause confusion and imply that a thread must be
idle before it can exit, which would cause a thread with timed pollers
to hang when exiting. This is not the case; a thread does not need to
wait for timed pollers to expire before exiting. Cleaning up these
examples will improve clarity.

Change-Id: I16aff7eb7c27aa6bc20d76b1894312b520717a7f
Signed-off-by: default avatarAnisa Su <anisa.su@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25295


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
parent 5abbade7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -183,8 +183,7 @@ nvmf_reactor_run(void *arg)

			spdk_thread_poll(thread, 0, 0);

			if (spdk_unlikely(spdk_thread_is_exited(thread) &&
					  spdk_thread_is_idle(thread))) {
			if (spdk_unlikely(spdk_thread_is_exited(thread))) {
				spdk_thread_destroy(thread);
			} else if (spdk_unlikely(lw_thread->resched)) {
				lw_thread->resched = false;
+2 −3
Original line number Diff line number Diff line
@@ -99,9 +99,8 @@ reactor_run(void)
		spdk_thread_poll(thread, 0, 0);

		/* spdk_unlikely() is a branch prediction macro. Here it means the
		 * thread should not be exited and idle, but it is still possible. */
		if (spdk_unlikely(spdk_thread_is_exited(thread) &&
				  spdk_thread_is_idle(thread))) {
		 * thread should not be exited, but it is still possible. */
		if (spdk_unlikely(spdk_thread_is_exited(thread))) {
			spdk_thread_destroy(thread);
		} else {
			spdk_ring_enqueue(reactor->threads, (void **)&lw_thread, 1, NULL);