From 13586cd82dc41f0300d888466a195cc9f1a1d0d2 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 18 Jan 2019 09:08:46 -0700 Subject: [PATCH] thread: Allow nested spdk_thread_poll calls This wasn't allowed at first to make debugging these thread changes easier. Now they're mostly solid, so let's allow this behavior. Change-Id: Ida689c738ed550ec46c3cb6cab6788a651c6088b Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/441159 Reviewed-by: Jim Harris Reviewed-by: Darek Stojaczyk Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System --- lib/thread/thread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index 6f428c095..0b7e6de1a 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -328,11 +328,11 @@ int spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs) { uint32_t msg_count; + struct spdk_thread *orig_thread; struct spdk_poller *poller; int rc = 0; - assert(_get_thread() == NULL); - + orig_thread = _get_thread(); tls_thread = thread; msg_count = _spdk_msg_queue_run_batch(thread, max_msgs); @@ -395,7 +395,7 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs) } } - tls_thread = NULL; + tls_thread = orig_thread; return rc; }