set thread names in server
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 25 Sep 2017 20:26:20 +0000 (23:26 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Tue, 26 Sep 2017 09:11:04 +0000 (12:11 +0300)
28 files changed:
include/nms_threads.h
src/db/libnxdb/dbcp.cpp
src/libnetxms/msgwq.cpp
src/libnetxms/tp.cpp
src/server/core/admin.cpp
src/server/core/alarm.cpp
src/server/core/client.cpp
src/server/core/datacoll.cpp
src/server/core/dbwrite.cpp
src/server/core/email.cpp
src/server/core/evproc.cpp
src/server/core/hk.cpp
src/server/core/jobmgr.cpp
src/server/core/ldap.cpp
src/server/core/mdconn.cpp
src/server/core/np.cpp
src/server/core/objects.cpp
src/server/core/poll.cpp
src/server/core/schedule.cpp
src/server/core/session.cpp
src/server/core/snmptrap.cpp
src/server/core/syncer.cpp
src/server/core/syslogd.cpp
src/server/core/tunnel.cpp
src/server/core/uptimecalc.cpp
src/server/core/userdb.cpp
src/server/core/watchdog.cpp
src/server/libnxsrv/agent.cpp

index 346bd29..662f235 100644 (file)
@@ -153,6 +153,49 @@ inline THREAD ThreadCreateEx(ThreadFunction start_address, int stack_size, void
        return thread;
 }
 
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+   DWORD dwType; // Must be 0x1000.
+   LPCSTR szName; // Pointer to name (in user addr space).
+   DWORD dwThreadID; // Thread ID (-1=caller thread).
+   DWORD dwFlags; // Reserved for future use, must be zero.
+ } THREADNAME_INFO;
+#pragma pack(pop)
+
+/**
+ * Set thread name. Thread can be set to INVALID_THREAD_HANDLE to change name of current thread.
+ */
+inline void ThreadSetName(THREAD thread, const char *name)
+{
+   THREADNAME_INFO info;
+   info.dwType = 0x1000;
+   info.szName = name;
+   info.dwThreadID = (thread != INVALID_THREAD_HANDLE) ? thread->id : (DWORD)-1;
+   info.dwFlags = 0;
+#pragma warning(push)
+#pragma warning(disable: 6320 6322)
+   __try
+   {
+      RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
+   }
+   __except(EXCEPTION_EXECUTE_HANDLER)
+   {
+   }
+#pragma warning(pop)
+}
+
+/**
+ * Set name for current thread
+ */
+inline void ThreadSetName(const char *name)
+{
+   ThreadSetName(INVALID_THREAD_HANDLE, name);
+}
+
+/**
+ * Exit thread
+ */
 inline void ThreadExit()
 {
 #ifdef UNDER_CE
@@ -345,6 +388,24 @@ inline THREAD ThreadCreateEx(ThreadFunction start_address, int stack_size, void
        }
 }
 
+/**
+ * Set thread name
+ */
+inline void ThreadSetName(THREAD thread, const char *name)
+{
+}
+
+/**
+ * Set name for current thread
+ */
+inline void ThreadSetName(const char *name)
+{
+   ThreadSetName(INVALID_THREAD_HANDLE, name);
+}
+
+/**
+ * Exit thread
+ */
 inline void ThreadExit(void)
 {
    pth_exit(NULL);
@@ -674,6 +735,27 @@ inline bool ThreadCreate(ThreadFunction start_address, int stack_size, void *arg
        return FALSE;
 }
 
+/**
+ * Set thread name
+ */
+inline void ThreadSetName(THREAD thread, const char *name)
+{
+#if HAVE_PTHREAD_SETNAME_NP
+   pthread_setname_np((thread != INVALID_THREAD_HANDLE) ? thread : pthread_self(), name);
+#endif
+}
+
+/**
+ * Set name for current thread
+ */
+inline void ThreadSetName(const char *name)
+{
+   ThreadSetName(INVALID_THREAD_HANDLE, name);
+}
+
+/**
+ * Exit thread
+ */
 inline void ThreadExit()
 {
    pthread_exit(NULL);
index 5956bcb..6fff23e 100644 (file)
@@ -191,7 +191,8 @@ static void ResetExpiredConnections()
  */
 static THREAD_RESULT THREAD_CALL MaintenanceThread(void *arg)
 {
-       nxlog_debug_tag(_T("db.connection.poll"), 1, _T("Database Connection Pool maintenance thread started"));
+   ThreadSetName("DBPoolMaint");
+   nxlog_debug_tag(_T("db.connection.poll"), 1, _T("Database Connection Pool maintenance thread started"));
 
    while(!ConditionWait(m_condShutdown, (m_connectionTTL > 0) ? m_connectionTTL * 750 : 300000))
    {
index 77c4410..ee6533a 100644 (file)
@@ -381,6 +381,7 @@ EnumerationCallbackResult MsgWaitQueue::houseKeeperCallback(const void *key, con
  */
 THREAD_RESULT THREAD_CALL MsgWaitQueue::housekeeperThread(void *arg)
 {
+   ThreadSetName("MsgWaitQueue");
    while(!m_shutdownCondition.wait(TTL_CHECK_INTERVAL))
    {
       m_housekeeperLock.lock();
index eeb74aa..a4a112e 100644 (file)
@@ -100,6 +100,18 @@ static THREAD_RESULT THREAD_CALL WorkerThread(void *arg)
 {
    ThreadPool *p = ((WorkerThreadInfo *)arg)->pool;
    Queue *q = p->queue;
+
+
+   char threadName[16];
+   threadName[0] = '$';
+#ifdef UNICODE
+   WideCharToMultiByte(CP_ACP, WC_DEFAULTCHAR | WC_COMPOSITECHECK, p->name, -1, &threadName[1], 11, NULL, NULL);
+#else
+   strlcpy(&threadName[1], p->name, 11);
+#endif
+   strlcat(threadName, "/WRK", 16);
+   ThreadSetName(threadName);
+
    while(true)
    {
       WorkRequest *rq = (WorkRequest *)q->getOrBlock();
@@ -137,6 +149,17 @@ static THREAD_RESULT THREAD_CALL WorkerThread(void *arg)
 static THREAD_RESULT THREAD_CALL MaintenanceThread(void *arg)
 {
    ThreadPool *p = (ThreadPool *)arg;
+
+   char threadName[16];
+   threadName[0] = '$';
+#ifdef UNICODE
+   WideCharToMultiByte(CP_ACP, WC_DEFAULTCHAR | WC_COMPOSITECHECK, p->name, -1, &threadName[1], 11, NULL, NULL);
+#else
+   strlcpy(&threadName[1], p->name, 11);
+#endif
+   strlcat(threadName, "/MNT", 16);
+   ThreadSetName(threadName);
+
    int count = 0;
    while(!ConditionWait(p->maintThreadStop, 5000))
    {
index 5635765..2d0470d 100644 (file)
@@ -111,6 +111,8 @@ close_session:
  */
 THREAD_RESULT THREAD_CALL LocalAdminListener(void *pArg)
 {
+   ThreadSetName("DebugConsole");
+
    SOCKET sock, sockClient;
    struct sockaddr_in servAddr;
    int errorCount = 0;
index c2fa7a2..71694fa 100644 (file)
@@ -1374,6 +1374,8 @@ void GetAlarmStats(NXCPMessage *pMsg)
  */
 static THREAD_RESULT THREAD_CALL WatchdogThread(void *arg)
 {
+   ThreadSetName("AlarmWatchdog");
+
        while(true)
        {
                if (m_condShutdown.wait(1000))
index 59edae4..8e1c177 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2016 Victor Kirhenshtein
+** Copyright (C) 2003-2017 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -66,24 +66,24 @@ void UnregisterClientSession(int id)
  */
 static THREAD_RESULT THREAD_CALL ClientKeepAliveThread(void *)
 {
-   int i, iSleepTime;
-   NXCPMessage msg;
+   ThreadSetName("ClientKeepAlive");
 
    // Read configuration
-   iSleepTime = ConfigReadInt(_T("KeepAliveInterval"), 60);
+   int iSleepTime = ConfigReadInt(_T("KeepAliveInterval"), 60);
 
    // Prepare keepalive message
+   NXCPMessage msg;
    msg.setCode(CMD_KEEPALIVE);
    msg.setId(0);
 
-   while(1)
+   while(true)
    {
       if (SleepAndCheckForShutdown(iSleepTime))
          break;
 
       msg.setField(VID_TIMESTAMP, (UINT32)time(NULL));
       RWLockReadLock(s_sessionListLock, INFINITE);
-      for(i = 0; i < MAX_CLIENT_SESSIONS; i++)
+      for(int i = 0; i < MAX_CLIENT_SESSIONS; i++)
          if (s_sessionList[i] != NULL)
             if (s_sessionList[i]->isAuthenticated())
                s_sessionList[i]->postMessage(&msg);
@@ -152,6 +152,7 @@ ConnectionProcessingResult ClientListener::processConnection(SOCKET s, const Ine
  */
 THREAD_RESULT THREAD_CALL ClientListenerThread(void *arg)
 {
+   ThreadSetName("ClientListener");
    UINT16 listenPort = (UINT16)ConfigReadInt(_T("ClientListenerPort"), SERVER_LISTEN_PORT_FOR_CLIENTS);
    ClientListener listener(listenPort);
    listener.setListenAddress(g_szListenAddress);
index ecfd3d3..f7e1a0a 100644 (file)
@@ -225,6 +225,8 @@ static void *GetTableData(DataCollectionTarget *dcTarget, DCTable *table, UINT32
  */
 static THREAD_RESULT THREAD_CALL DataCollector(void *pArg)
 {
+   ThreadSetName("DataCollector");
+
    UINT32 dwError;
 
    TCHAR *pBuffer = (TCHAR *)malloc(MAX_LINE_SIZE * sizeof(TCHAR));
@@ -386,6 +388,8 @@ static void QueueItems(NetObj *object, void *data)
  */
 static THREAD_RESULT THREAD_CALL ItemPoller(void *pArg)
 {
+   ThreadSetName("ItemPoller");
+
    UINT32 dwSum, currPos = 0;
    UINT32 dwTimingHistory[60 / ITEM_POLLING_INTERVAL];
    INT64 qwStart;
@@ -428,6 +432,8 @@ static THREAD_RESULT THREAD_CALL ItemPoller(void *pArg)
  */
 static THREAD_RESULT THREAD_CALL StatCollector(void *pArg)
 {
+   ThreadSetName("StatCollector");
+
    UINT32 i, currPos = 0;
    UINT32 pollerQS[12], dbWriterQS[12];
    UINT32 iDataWriterQS[12], rawDataWriterQS[12], dbAndIDataWriterQS[12];
@@ -492,6 +498,7 @@ static THREAD_RESULT THREAD_CALL StatCollector(void *pArg)
  */
 THREAD_RESULT THREAD_CALL CacheLoader(void *arg)
 {
+   ThreadSetName("CacheLoader");
    DbgPrintf(2, _T("DCI cache loader thread started"));
    while(true)
    {
index ed711a2..6c737c5 100644 (file)
@@ -137,7 +137,8 @@ void QueueRawDciDataUpdate(time_t timestamp, UINT32 dciId, const TCHAR *rawValue
  */
 static THREAD_RESULT THREAD_CALL DBWriteThread(void *arg)
 {
-   while(1)
+   ThreadSetName("DBWriter");
+   while(true)
    {
       DELAYED_SQL_REQUEST *rq = (DELAYED_SQL_REQUEST *)g_dbWriterQueue->getOrBlock();
       if (rq == INVALID_POINTER_VALUE)   // End-of-job indicator
@@ -175,7 +176,8 @@ static THREAD_RESULT THREAD_CALL DBWriteThread(void *arg)
  */
 static THREAD_RESULT THREAD_CALL IDataWriteThread(void *arg)
 {
-   while(1)
+   ThreadSetName("DBWriter/IData");
+   while(true)
    {
                DELAYED_IDATA_INSERT *rq = (DELAYED_IDATA_INSERT *)g_dciDataWriterQueue->getOrBlock();
       if (rq == INVALID_POINTER_VALUE)   // End-of-job indicator
@@ -246,7 +248,8 @@ static THREAD_RESULT THREAD_CALL IDataWriteThread(void *arg)
  */
 static THREAD_RESULT THREAD_CALL RawDataWriteThread(void *arg)
 {
-   while(1)
+   ThreadSetName("DBWriter/RData");
+   while(true)
    {
                DELAYED_RAW_DATA_UPDATE *rq = (DELAYED_RAW_DATA_UPDATE *)g_dciRawDataWriterQueue->getOrBlock();
       if (rq == INVALID_POINTER_VALUE)   // End-of-job indicator
index 6744634..8e1a000 100644 (file)
@@ -406,6 +406,7 @@ static THREAD_RESULT THREAD_CALL MailerThread(void *pArg)
       _T("SMTP conversation failure")
    };
 
+   ThreadSetName("Mailer");
        DbgPrintf(1, _T("SMTP mailer thread started"));
    while(1)
    {
index 645b972..8690b1d 100644 (file)
@@ -52,6 +52,8 @@ static void BroadcastEvent(ClientSession *pSession, void *pArg)
  */
 static THREAD_RESULT THREAD_CALL EventStormDetector(void *arg)
 {
+   ThreadSetName("EvtStormDetect");
+
        INT64 numEvents, prevEvents, eventsPerSecond;
        int duration, actualDuration = 0;
        
@@ -98,6 +100,8 @@ static THREAD_RESULT THREAD_CALL EventStormDetector(void *arg)
  */
 static THREAD_RESULT THREAD_CALL EventLogger(void *arg)
 {
+   ThreadSetName("EventLogger");
+
    while(!IsShutdownInProgress())
    {
       Event *pEvent = (Event *)s_loggerQueue->getOrBlock();
@@ -163,7 +167,9 @@ static THREAD_RESULT THREAD_CALL EventLogger(void *arg)
  */
 THREAD_RESULT THREAD_CALL EventProcessor(void *arg)
 {
-       s_loggerQueue = new Queue;
+   ThreadSetName("EventProcessor");
+
+   s_loggerQueue = new Queue;
        s_threadLogger = ThreadCreateEx(EventLogger, 0, NULL);
        s_threadStormDetector = ThreadCreateEx(EventStormDetector, 0, NULL);
    while(!IsShutdownInProgress())
index 23f1b17..4580fda 100644 (file)
@@ -159,6 +159,8 @@ static bool s_shutdown = false;
  */
 static THREAD_RESULT THREAD_CALL HouseKeeper(void *pArg)
 {
+   ThreadSetName("Housekeeper");
+
    // Read housekeeping configuration
    int hour;
    int minute;
index 0ff0fe2..a996807 100644 (file)
@@ -175,6 +175,7 @@ static void CleanupJobQueue(NetObj *object, void *data)
  */
 THREAD_RESULT THREAD_CALL JobManagerThread(void *arg)
 {
+   ThreadSetName("JobManager");
        DbgPrintf(2, _T("Job Manager worker thread started"));
 
        while(!SleepAndCheckForShutdown(10))
index 869ac45..bdae6bd 100644 (file)
@@ -994,6 +994,7 @@ UINT32 LDAPConnection::ldapUserLogin(const TCHAR *name, const TCHAR *password)
  */
 THREAD_RESULT THREAD_CALL SyncLDAPUsers(void *arg)
 {
+   ThreadSetName("LDAPSync");
    UINT32 syncInterval = ConfigReadInt(_T("LdapSyncInterval"), 0);
    if (syncInterval == 0)
    {
index b48499a..f2b0b8e 100644 (file)
@@ -112,6 +112,7 @@ ConnectionProcessingResult MobileDeviceListener::processConnection(SOCKET s, con
  */
 THREAD_RESULT THREAD_CALL MobileDeviceListenerThread(void *arg)
 {
+   ThreadSetName("MDevListener");
    UINT16 listenPort = (UINT16)ConfigReadInt(_T("MobileDeviceListenerPort"), SERVER_LISTEN_PORT_FOR_MOBILES);
    MobileDeviceListener listener(listenPort);
    listener.setListenAddress(g_szListenAddress);
index 5007b7f..1e005bd 100644 (file)
@@ -668,6 +668,7 @@ THREAD_RESULT THREAD_CALL NodePoller(void *arg)
    NEW_NODE *pInfo;
        TCHAR szIpAddr[64];
 
+   ThreadSetName("NodePoller");
    nxlog_debug(1, _T("Node poller started"));
 
    while(!IsShutdownInProgress())
index 06c376b..644a4ef 100644 (file)
@@ -70,6 +70,7 @@ static int m_iStatusThresholds[4];
  */
 static THREAD_RESULT THREAD_CALL ApplyTemplateThread(void *pArg)
 {
+   ThreadSetName("ApplyTemplates");
        DbgPrintf(1, _T("Apply template thread started"));
    while(1)
    {
@@ -155,6 +156,7 @@ static void UpdateDataCollectionCache(ObjectIndex *idx)
  */
 static THREAD_RESULT THREAD_CALL CacheLoadingThread(void *pArg)
 {
+   ThreadSetName("CacheLoader");
    DbgPrintf(1, _T("Started caching of DCI values"));
 
        UpdateDataCollectionCache(&g_idxNodeById);
@@ -182,6 +184,7 @@ static void UpdateMapCallback(NetObj *object, void *data)
  */
 static THREAD_RESULT THREAD_CALL MapUpdateThread(void *pArg)
 {
+   ThreadSetName("MapUpdate");
        DbgPrintf(2, _T("Map update thread started"));
        while(!SleepAndCheckForShutdown(60))
        {
index 202ddc2..298c2c4 100644 (file)
@@ -520,6 +520,7 @@ static void CheckRange(const InetAddressListElement& range)
  */
 static THREAD_RESULT THREAD_CALL ActiveDiscoveryPoller(void *arg)
 {
+   ThreadSetName("ActiveDiscovery");
    int nInterval = ConfigReadInt(_T("ActiveDiscoveryInterval"), 7200);
 
    // Main loop
@@ -635,6 +636,7 @@ static void QueueForPolling(NetObj *object, void *data)
  */
 THREAD_RESULT THREAD_CALL PollManager(void *pArg)
 {
+   ThreadSetName("PollManager");
    g_pollerThreadPool = ThreadPoolCreate(ConfigReadInt(_T("PollerThreadPoolBaseSize"), 10), ConfigReadInt(_T("PollerThreadPoolMaxSize"), 250), _T("POLLERS"));
 
    // Start active discovery poller
index 751ff2e..00e86a7 100644 (file)
@@ -727,6 +727,7 @@ UINT32 UpdateScheduledTaskFromMsg(NXCPMessage *request,  UINT32 owner, UINT64 sy
  */
 static THREAD_RESULT THREAD_CALL AdHocScheduler(void *arg)
 {
+   ThreadSetName("Scheduler/A");
    UINT32 sleepTime = 1;
    UINT32 watchdogId = WatchdogAddThread(_T("Ad hoc scheduler"), 5);
    nxlog_debug(3, _T("Ad hoc scheduler started"));
@@ -795,6 +796,7 @@ static THREAD_RESULT THREAD_CALL AdHocScheduler(void *arg)
  */
 static THREAD_RESULT THREAD_CALL RecurrentScheduler(void *arg)
 {
+   ThreadSetName("Scheduler/R");
    UINT32 watchdogId = WatchdogAddThread(_T("Recurrent scheduler"), 5);
    nxlog_debug(3, _T("Recurrent scheduler started"));
    do
index c848ee4..b5f79d6 100644 (file)
@@ -183,6 +183,7 @@ DEFINE_THREAD_STARTER(deleteRepository)
  */
 THREAD_RESULT THREAD_CALL ClientSession::readThreadStarter(void *pArg)
 {
+   ThreadSetName("SessionReader");
    ((ClientSession *)pArg)->readThread();
 
    // When ClientSession::ReadThread exits, all other session
@@ -198,6 +199,7 @@ THREAD_RESULT THREAD_CALL ClientSession::readThreadStarter(void *pArg)
  */
 THREAD_RESULT THREAD_CALL ClientSession::writeThreadStarter(void *pArg)
 {
+   ThreadSetName("SessionWriter");
    ((ClientSession *)pArg)->writeThread();
    return THREAD_OK;
 }
@@ -207,6 +209,7 @@ THREAD_RESULT THREAD_CALL ClientSession::writeThreadStarter(void *pArg)
  */
 THREAD_RESULT THREAD_CALL ClientSession::processingThreadStarter(void *pArg)
 {
+   ThreadSetName("SessionProc");
    ((ClientSession *)pArg)->processingThread();
    return THREAD_OK;
 }
index 3a21985..2444b60 100644 (file)
@@ -667,6 +667,8 @@ THREAD_RESULT THREAD_CALL SNMPTrapReceiver(void *pArg)
    static BYTE engineId[] = { 0x80, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00 };
    SNMP_Engine localEngine(engineId, 12);
 
+   ThreadSetName("SNMPTrapRecv");
+
    SOCKET hSocket = socket(AF_INET, SOCK_DGRAM, 0);
 #ifdef WITH_IPV6
    SOCKET hSocket6 = socket(AF_INET6, SOCK_DGRAM, 0);
index 2a56fc6..930a68d 100644 (file)
@@ -114,6 +114,8 @@ void SaveObjects(DB_HANDLE hdb, UINT32 watchdogId)
  */
 THREAD_RESULT THREAD_CALL Syncer(void *arg)
 {
+   ThreadSetName("Syncer");
+
    int syncInterval = ConfigReadInt(_T("SyncInterval"), 60);
    UINT32 watchdogId = WatchdogAddThread(_T("Syncer Thread"), 30);
 
index dc63d38..dabf70c 100644 (file)
@@ -384,6 +384,7 @@ static void BroadcastSyslogMessage(ClientSession *pSession, void *pArg)
  */
 static THREAD_RESULT THREAD_CALL SyslogWriterThread(void *arg)
 {
+   ThreadSetName("SyslogWriter");
    DbgPrintf(1, _T("Syslog writer thread started"));
    while(true)
    {
@@ -500,11 +501,10 @@ static void ProcessSyslogMessage(QueuedSyslogMessage *msg)
  */
 static THREAD_RESULT THREAD_CALL SyslogProcessingThread(void *pArg)
 {
-   QueuedSyslogMessage *msg;
-
+   ThreadSetName("SyslogProcessor");
    while(true)
    {
-      msg = (QueuedSyslogMessage *)g_syslogProcessingQueue.getOrBlock();
+      QueuedSyslogMessage *msg = (QueuedSyslogMessage *)g_syslogProcessingQueue.getOrBlock();
       if (msg == INVALID_POINTER_VALUE)
          break;
 
@@ -626,6 +626,8 @@ static void CreateParserFromConfig()
  */
 static THREAD_RESULT THREAD_CALL SyslogReceiver(void *pArg)
 {
+   ThreadSetName("SyslogReceiver");
+
    SOCKET hSocket = socket(AF_INET, SOCK_DGRAM, 0);
 #ifdef WITH_IPV6
    SOCKET hSocket6 = socket(AF_INET6, SOCK_DGRAM, 0);
index c1e571c..d14905e 100644 (file)
@@ -346,6 +346,7 @@ void AgentTunnel::recvThread()
  */
 THREAD_RESULT THREAD_CALL AgentTunnel::recvThreadStarter(void *arg)
 {
+   ThreadSetName("TunnelReceiver");
    ((AgentTunnel *)arg)->recvThread();
    ((AgentTunnel *)arg)->decRefCount();
    return THREAD_OK;
@@ -1106,6 +1107,7 @@ ConnectionProcessingResult TunnelListener::processConnection(SOCKET s, const Ine
  */
 THREAD_RESULT THREAD_CALL TunnelListenerThread(void *arg)
 {
+   ThreadSetName("TunnelListener");
    s_tunnelListenerLock.lock();
    UINT16 listenPort = (UINT16)ConfigReadULong(_T("AgentTunnelListenPort"), 4703);
    TunnelListener listener(listenPort);
index 8520285..47144ac 100644 (file)
@@ -30,6 +30,7 @@ THREAD_RESULT THREAD_CALL UptimeCalculator(void *arg)
 {
        const int calcInterval = 60; 
 
+   ThreadSetName("UptimeCalc");
        DbgPrintf(1, _T("UptimeCalculator thread started"));
 
        while(TRUE)
index 0722fa4..e8f7477 100644 (file)
@@ -150,6 +150,7 @@ static UINT64 GetEffectiveSystemRights(User *user)
  */
 static THREAD_RESULT THREAD_CALL AccountStatusUpdater(void *arg)
 {
+   ThreadSetName("AccountUpdate");
        DbgPrintf(2, _T("User account status update thread started"));
        while(!SleepAndCheckForShutdown(60))
        {
index c1ee5a4..41dbf94 100644 (file)
@@ -155,6 +155,7 @@ void WatchdogGetThreads(StringList *out)
  */
 THREAD_RESULT THREAD_CALL WatchdogThread(void *arg)
 {
+   ThreadSetName("Watchdog");
    nxlog_debug(1, _T("Watchdog thread started"));
    while(!SleepAndCheckForShutdown(20))
    {
index 0be57d5..7ab4d4a 100644 (file)
@@ -68,6 +68,7 @@ void LIBNXSRV_EXPORTABLE SetAgentDEP(int iPolicy)
  */
 THREAD_RESULT THREAD_CALL AgentConnection::receiverThreadStarter(void *pArg)
 {
+   ThreadSetName("AgentReceiver");
    ((AgentConnection *)pArg)->receiverThread();
    ((AgentConnection *)pArg)->decInternalRefCount();
    return THREAD_OK;