[td-11818]Set thread name.
This commit is contained in:
parent
bf26efb518
commit
971b1d2890
|
@ -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" {
|
||||||
#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) {
|
||||||
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) {
|
||||||
|
|
||||||
/* ------------------------ 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) {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue