提交 971b1d28 编写于 作者: H Haojun Liao

[td-11818]Set thread name.

上级 bf26efb5
...@@ -51,6 +51,7 @@ extern "C" { ...@@ -51,6 +51,7 @@ extern "C" {
#include <libgen.h> #include <libgen.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/prctl.h>
#include "osAtomic.h" #include "osAtomic.h"
#include "osDef.h" #include "osDef.h"
......
...@@ -181,7 +181,8 @@ extern "C" { ...@@ -181,7 +181,8 @@ extern "C" {
#endif #endif
#else #else
// Windows // Windows
#define setThreadName(name) // #define setThreadName(name)
#define setThreadName(name) do { prctl(PR_SET_NAME, (name)); } while (0)
#endif #endif
#if defined(_WIN32) #if defined(_WIN32)
......
...@@ -487,6 +487,8 @@ static void *dnodeThreadRoutine(void *param) { ...@@ -487,6 +487,8 @@ static void *dnodeThreadRoutine(void *param) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt; SDnodeMgmt *pMgmt = &pDnode->dmgmt;
int32_t ms = pDnode->cfg.statusInterval * 1000; int32_t ms = pDnode->cfg.statusInterval * 1000;
setThreadName("dnode-hb");
while (true) { while (true) {
pthread_testcancel(); pthread_testcancel();
taosMsleep(ms); taosMsleep(ms);
......
...@@ -98,6 +98,8 @@ int32_t vnodePutReqToVQueryQ(SVnode* pVnode, struct SRpcMsg* pReq) { ...@@ -98,6 +98,8 @@ int32_t vnodePutReqToVQueryQ(SVnode* pVnode, struct SRpcMsg* pReq) {
/* ------------------------ STATIC METHODS ------------------------ */ /* ------------------------ STATIC METHODS ------------------------ */
static void* loop(void* arg) { static void* loop(void* arg) {
setThreadName("vnode-commit");
SVnodeTask* pTask; SVnodeTask* pTask;
for (;;) { for (;;) {
pthread_mutex_lock(&(vnodeMgr.mutex)); pthread_mutex_lock(&(vnodeMgr.mutex));
......
...@@ -235,7 +235,7 @@ void *rpcOpen(const SRpcInit *pInit) { ...@@ -235,7 +235,7 @@ void *rpcOpen(const SRpcInit *pInit) {
pRpc = (SRpcInfo *)calloc(1, sizeof(SRpcInfo)); pRpc = (SRpcInfo *)calloc(1, sizeof(SRpcInfo));
if (pRpc == NULL) return NULL; if (pRpc == NULL) return NULL;
if (pInit->label) tstrncpy(pRpc->label, pInit->label, strlen(pInit->label)); if (pInit->label) tstrncpy(pRpc->label, pInit->label, tListLen(pInit->label));
pRpc->connType = pInit->connType; pRpc->connType = pInit->connType;
if (pRpc->connType == TAOS_CONN_CLIENT) { if (pRpc->connType == TAOS_CONN_CLIENT) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册