[td-11818]Set thread name.
This commit is contained in:
parent
bf26efb518
commit
971b1d2890
|
@ -51,6 +51,7 @@ extern "C" {
|
|||
#include <libgen.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include "osAtomic.h"
|
||||
#include "osDef.h"
|
||||
|
|
|
@ -181,7 +181,8 @@ extern "C" {
|
|||
#endif
|
||||
#else
|
||||
// Windows
|
||||
#define setThreadName(name)
|
||||
// #define setThreadName(name)
|
||||
#define setThreadName(name) do { prctl(PR_SET_NAME, (name)); } while (0)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
|
|
@ -487,6 +487,8 @@ static void *dnodeThreadRoutine(void *param) {
|
|||
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
|
||||
int32_t ms = pDnode->cfg.statusInterval * 1000;
|
||||
|
||||
setThreadName("dnode-hb");
|
||||
|
||||
while (true) {
|
||||
pthread_testcancel();
|
||||
taosMsleep(ms);
|
||||
|
|
|
@ -98,6 +98,8 @@ int32_t vnodePutReqToVQueryQ(SVnode* pVnode, struct SRpcMsg* pReq) {
|
|||
|
||||
/* ------------------------ STATIC METHODS ------------------------ */
|
||||
static void* loop(void* arg) {
|
||||
setThreadName("vnode-commit");
|
||||
|
||||
SVnodeTask* pTask;
|
||||
for (;;) {
|
||||
pthread_mutex_lock(&(vnodeMgr.mutex));
|
||||
|
|
|
@ -235,7 +235,7 @@ void *rpcOpen(const SRpcInit *pInit) {
|
|||
pRpc = (SRpcInfo *)calloc(1, sizeof(SRpcInfo));
|
||||
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;
|
||||
if (pRpc->connType == TAOS_CONN_CLIENT) {
|
||||
|
|
Loading…
Reference in New Issue