From c2747839f49dd42ab61a5ad9c618c61386b997f9 Mon Sep 17 00:00:00 2001 From: peilixia Date: Fri, 23 Sep 2022 17:03:56 +0800 Subject: [PATCH] fixed 55fd6d6 from https://gitee.com/peilixia/commonlibrary_c_utils/pulls/119 modify uselessAssignmentPtrArg Signed-off-by: peilixia --- base/src/thread_ex.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/base/src/thread_ex.cpp b/base/src/thread_ex.cpp index 3fb2982..181e82d 100644 --- a/base/src/thread_ex.cpp +++ b/base/src/thread_ex.cpp @@ -30,19 +30,19 @@ struct ThreadParam { std::string name; // prctl only support set the name of the calling process. - static int Proxy(const ThreadParam* t) + static int Proxy(const ThreadParam** t) { - if (t == nullptr) { + if (*t == nullptr) { UTILS_LOGD("invalid param."); return -1; } - ThreadFunc f = t->startRoutine; - void* userData = t->args; - int prio = t->priority; - std::string threadName = t->name; + ThreadFunc f = (*t)->startRoutine; + void* userData = (*t)->args; + int prio = (*t)->priority; + std::string threadName = (*t)->name; - delete t; - t = nullptr; + delete *t; + *t = nullptr; // set thread priority (void)setpriority(PRIO_PROCESS, 0, prio); @@ -80,7 +80,7 @@ bool CreatePThread(ThreadParam& para, size_t stackSize, pthread_t *threadId) errno = 0; pthread_t thread; - int result = pthread_create(&thread, &attr, reinterpret_cast(para.startRoutine), para.args); + int result = pthread_create(&thread, &attr, reinterpret_cast(para.startRoutine), ¶.args); pthread_attr_destroy(&attr); if (result != 0) { -- Gitee