From 817c7b4f6c69285e8f0ac5c3a05f2dc3ccbbee4f Mon Sep 17 00:00:00 2001 From: Jin Yu Date: Mon, 8 Jun 2020 22:59:13 +0800 Subject: [PATCH] thread: add info logs If the operation function is not specified in spdk thread lib init. Add a info logs to tell user that you should manage and poll the thread. Change-Id: I536c6954c129fbbbc2d19776866fa348d49688ee Signed-off-by: Jin Yu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2804 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Paul Luse Reviewed-by: Jim Harris --- lib/thread/thread.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index c71a7bb79..65d91ce35 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -124,7 +124,12 @@ spdk_thread_lib_init(spdk_new_thread_fn new_thread_fn, size_t ctx_sz) { assert(g_new_thread_fn == NULL); assert(g_thread_op_fn == NULL); - g_new_thread_fn = new_thread_fn; + + if (new_thread_fn == NULL) { + SPDK_INFOLOG(SPDK_LOG_THREAD, "new_thread_fn was not specified at spdk_thread_lib_init\n"); + } else { + g_new_thread_fn = new_thread_fn; + } return _thread_lib_init(ctx_sz); } @@ -143,8 +148,12 @@ spdk_thread_lib_init_ext(spdk_thread_op_fn thread_op_fn, return -EINVAL; } - g_thread_op_fn = thread_op_fn; - g_thread_op_supported_fn = thread_op_supported_fn; + if (thread_op_fn == NULL && thread_op_supported_fn == NULL) { + SPDK_INFOLOG(SPDK_LOG_THREAD, "thread_op_fn and thread_op_supported_fn were not specified\n"); + } else { + g_thread_op_fn = thread_op_fn; + g_thread_op_supported_fn = thread_op_supported_fn; + } return _thread_lib_init(ctx_sz); }