From f23018e38a690246d2bf18fe704535edc796ae1e Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Wed, 19 Oct 2022 11:26:23 +0800 Subject: [PATCH] fix: get a thread id for printing with taosGetPthreadId --- source/dnode/mgmt/node_mgmt/src/dmProc.c | 8 ++++---- source/dnode/vnode/src/sma/smaEnv.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/node_mgmt/src/dmProc.c b/source/dnode/mgmt/node_mgmt/src/dmProc.c index 0bd88a9f28..5cf73cf1fd 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmProc.c +++ b/source/dnode/mgmt/node_mgmt/src/dmProc.c @@ -380,7 +380,7 @@ int32_t dmRunProc(SProc *proc) { dError("node:%s, failed to create pthread since %s", proc->name, terrstr()); return -1; } - dDebug("node:%s, thread:%p is created to consume pqueue", proc->name, (void *)proc->pthread); + dDebug("node:%s, thread:%" PRId64 " is created to consume pqueue", proc->name, taosGetPthreadId(proc->pthread)); } if (proc->ptype & DND_PROC_CHILD) { @@ -389,7 +389,7 @@ int32_t dmRunProc(SProc *proc) { dError("node:%s, failed to create cthread since %s", proc->name, terrstr()); return -1; } - dDebug("node:%s, thread:%p is created to consume cqueue", proc->name, (void *)proc->cthread); + dDebug("node:%s, thread:%" PRId64 " is created to consume cqueue", proc->name, taosGetPthreadId(proc->cthread)); } taosThreadAttrDestroy(&thAttr); @@ -399,14 +399,14 @@ int32_t dmRunProc(SProc *proc) { void dmStopProc(SProc *proc) { proc->stop = true; if (taosCheckPthreadValid(proc->pthread)) { - dDebug("node:%s, start to join pthread:%p", proc->name, (void *)proc->pthread); + dDebug("node:%s, start to join pthread:%" PRId64 "", proc->name, taosGetPthreadId(proc->pthread)); tsem_post(&proc->pqueue->sem); taosThreadJoin(proc->pthread, NULL); taosThreadClear(&proc->pthread); } if (taosCheckPthreadValid(proc->cthread)) { - dDebug("node:%s, start to join cthread:%p", proc->name, (void *)proc->cthread); + dDebug("node:%s, start to join cthread:%" PRId64 "", proc->name, taosGetPthreadId(proc->cthread)); tsem_post(&proc->cqueue->sem); taosThreadJoin(proc->cthread, NULL); taosThreadClear(&proc->cthread); diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index 46b0a8ac1d..a272f5fc97 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -455,7 +455,7 @@ static int32_t tdRsmaStopExecutor(const SSma *pSma) { for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) { if (taosCheckPthreadValid(pthread[i])) { - smaDebug("vgId:%d, start to join pthread for rsma:%p", SMA_VID(pSma), (void *)pthread[i]); + smaDebug("vgId:%d, start to join pthread for rsma:%" PRId64 "", SMA_VID(pSma), taosGetPthreadId(pthread[i])); taosThreadJoin(pthread[i], NULL); } }