diff --git a/base/src/thread_ex.cpp b/base/src/thread_ex.cpp index 3fb2982ab1ac37b2bd6bfa78750297539bc9e07c..181e82d44c8bd97154ba44b3e3f8d8363285f09a 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) {