From 3e4284bb32b1515cdcac6741d2c2e94f64f08063 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sat, 11 Jun 2016 23:45:23 +0000 Subject: MRA: change avatars load threads count default value from 4 to 1 add threads names git-svn-id: http://svn.miranda-ng.org/main/trunk@16948 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/mir_full.sln | 2 +- plugins/AVS/src/cache.cpp | 2 + plugins/AVS/src/poll.cpp | 2 + plugins/AVS/src/services.cpp | 2 + plugins/Clist_nicer/src/contact.cpp | 2 + plugins/HistoryStats/src/statistic.cpp | 3 ++ plugins/KeyboardNotify/src/main.cpp | 2 + plugins/NewAwaySysMod/src/Client.cpp | 2 + plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 2 + plugins/PluginUpdater/src/DlgListNew.cpp | 4 ++ plugins/PluginUpdater/src/DlgUpdate.cpp | 7 +++ plugins/Popup/src/popup_thread.cpp | 2 + plugins/Popup/src/popup_wnd2.cpp | 2 + plugins/Scriver/src/chat/window.cpp | 2 + plugins/SeenPlugin/src/utils.cpp | 4 ++ plugins/SmileyAdd/src/download.cpp | 2 + plugins/SmileyAdd/src/smltool.cpp | 2 + plugins/StartupSilence/src/main.cpp | 60 +++++++++++++------------ plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 2 + plugins/TabSRMM/src/chat/window.cpp | 2 + plugins/TabSRMM/src/generic_msghandlers.cpp | 2 + plugins/TabSRMM/src/sendqueue.cpp | 2 + plugins/TabSRMM/src/trayicon.cpp | 2 + plugins/TipperYM/src/message_pump.cpp | 2 + plugins/WhenWasIt/src/services.cpp | 2 + protocols/IRCG/src/commandmonitor.cpp | 2 + protocols/IRCG/src/irclib.cpp | 5 +++ protocols/IRCG/src/ircproto.cpp | 5 +++ protocols/IRCG/src/scripting.cpp | 1 + protocols/IRCG/src/services.cpp | 4 ++ protocols/IcqOscarJ/src/icq_avatar.cpp | 1 + protocols/IcqOscarJ/src/icq_direct.cpp | 2 + protocols/IcqOscarJ/src/icq_infoupdate.cpp | 1 + protocols/IcqOscarJ/src/icq_proto.cpp | 4 ++ protocols/IcqOscarJ/src/icq_rates.cpp | 1 + protocols/IcqOscarJ/src/icq_server.cpp | 3 ++ protocols/IcqOscarJ/src/icq_servlist.cpp | 1 + protocols/IcqOscarJ/src/log.cpp | 1 + protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 2 + protocols/IcqOscarJ/src/utilities.cpp | 2 + protocols/JabberG/src/jabber_byte.cpp | 2 + protocols/JabberG/src/jabber_console.cpp | 2 + protocols/JabberG/src/jabber_file.cpp | 2 + protocols/JabberG/src/jabber_ibb.cpp | 2 + protocols/JabberG/src/jabber_iq.cpp | 3 ++ protocols/JabberG/src/jabber_opt.cpp | 2 + protocols/JabberG/src/jabber_proto.cpp | 4 ++ protocols/JabberG/src/jabber_thread.cpp | 1 + protocols/JabberG/src/jabber_util.cpp | 2 + protocols/MRA/src/MraAvatars.cpp | 24 +++++----- protocols/MRA/src/MraConstans.h | 2 +- protocols/MRA/src/MraFilesQueue.cpp | 4 ++ protocols/MRA/src/Mra_functions.cpp | 8 ++-- protocols/MRA/src/Mra_proto.cpp | 2 + protocols/Tox/src/tox_contacts.cpp | 2 + protocols/Tox/src/tox_messages.cpp | 4 ++ protocols/Tox/src/tox_network.cpp | 1 + protocols/Tox/src/tox_search.cpp | 3 ++ 58 files changed, 179 insertions(+), 44 deletions(-) diff --git a/bin10/mir_full.sln b/bin10/mir_full.sln index 4b8e49b570..04505ced36 100644 --- a/bin10/mir_full.sln +++ b/bin10/mir_full.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +# Visual C++ Express 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Miranda", "..\src\miranda32\miranda32.vcxproj", "{F9916510-9055-4C9F-997A-3755DEC1511B}" ProjectSection(ProjectDependencies) = postProject {538E451F-E667-4D07-BCE6-976ECC7BB8D1} = {538E451F-E667-4D07-BCE6-976ECC7BB8D1} diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 01e3c65a23..57f78e88a3 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -213,6 +213,8 @@ int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode) void PicLoader(LPVOID) { + Thread_SetName("AVS: PicLoader"); + DWORD dwDelay = db_get_dw(NULL, AVS_MODULE, "picloader_sleeptime", 80); if (dwDelay < 30) diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index 38d09b75e6..a713a71935 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -208,6 +208,8 @@ int FetchAvatarFor(MCONTACT hContact, char *szProto) static void RequestThread(void *) { + Thread_SetName("AVS: RequestThread"); + while (!g_shutDown) { mir_cslockfull lck(cs); diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 3be64cf8df..50f6134e31 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -799,6 +799,8 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam) static void ReloadMyAvatar(LPVOID lpParam) { + Thread_SetName("AVS: ReloadMyAvatar"); + char *szProto = (char *)lpParam; mir_sleep(500); diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index ad46597c14..cd8a3d8f93 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -105,6 +105,8 @@ extern TCHAR g_ptszEventName[]; void MF_UpdateThread(LPVOID) { + Thread_SetName("CList_nicer: MF_UpdateThread"); + HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, g_ptszEventName); WaitForSingleObject(hEvent, 20000); diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index d0b349934b..9bcdaaa201 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -1370,6 +1370,8 @@ bool Statistic::createStatisticsSteps() void __cdecl Statistic::threadProc(void *lpParameter) { + Thread_SetName("HistoryStats: Statistic::threadProc"); + Statistic* pStats = reinterpret_cast(lpParameter); SetEvent(pStats->m_hThreadPushEvent); @@ -1388,6 +1390,7 @@ void __cdecl Statistic::threadProc(void *lpParameter) void __cdecl Statistic::threadProcSteps(void *lpParameter) { + Thread_SetName("HistoryStats: Statistic::threadProcSteps"); Statistic* pStats = reinterpret_cast(lpParameter); if (pStats->m_Settings.m_ThreadLowPriority) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index af392241d3..54d1992fbb 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -273,6 +273,8 @@ static void __cdecl FlashThreadFunction(void*) BOOL bEvent = FALSE; DWORD dwEventStarted = 0, dwFlashStarted = 0; BYTE data, unchangedLeds; + + Thread_SetName("KeyboardNotify: FlashThreadFunction"); while (TRUE) { unchangedLeds = (BYTE)(LedState(VK_PAUSE) * !bFlashLed[2] + ((LedState(VK_NUMLOCK) * !bFlashLed[0]) << 1) + ((LedState(VK_CAPITAL) * !bFlashLed[1]) << 2)); diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index 752e004b15..c08508db61 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -30,6 +30,8 @@ HANDLE g_hUpdateMsgsThread = NULL; void __cdecl UpdateMsgsThreadProc(void *) { + Thread_SetName("NewAwaySysMod: UpdateMsgsThreadProc"); + int numAccs; PROTOACCOUNT **accs; Proto_EnumAccounts(&numAccs, &accs); diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 50da664b4e..6b8d51228f 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -50,6 +50,8 @@ public: // _ad must be allocated using "new CAutoreplyData()" void __cdecl AutoreplyDelayThread(void *_ad) { + Thread_SetName("NewAwaySysMod: AutoreplyDelayThread"); + CAutoreplyData *ad = (CAutoreplyData*)_ad; _ASSERT(ad && ad->hContact && ad->Reply.GetLen()); char *szProto = GetContactProto(ad->hContact); diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 6f15fc8024..6ad434754f 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -34,6 +34,8 @@ static void SelectAll(HWND hDlg, bool bEnable) static void ApplyDownloads(void *param) { + Thread_SetName("PluginUpdater: ApplyDownloads"); + HWND hDlg = (HWND)param; ////////////////////////////////////////////////////////////////////////////////////// @@ -376,6 +378,8 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const TCHAR* t // static void GetList(void *) { + Thread_SetName("PluginUpdater: GetList"); + TCHAR tszTempPath[MAX_PATH]; DWORD dwLen = GetTempPath(_countof(tszTempPath), tszTempPath); if (tszTempPath[dwLen-1] == '\\') diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 98256b7e56..d4b4ce1e7d 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -43,6 +43,8 @@ static void SetStringText(HWND hWnd, size_t i, TCHAR *ptszText) static void ApplyUpdates(void *param) { + Thread_SetName("PluginUpdater: ApplyUpdates"); + HWND hDlg = (HWND)param; OBJLIST &todo = *(OBJLIST *)GetWindowLongPtr(hDlg, GWLP_USERDATA); if (todo.getCount() == 0) { @@ -380,6 +382,8 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM static void DlgUpdateSilent(void *param) { + Thread_SetName("PluginUpdater: DlgUpdateSilent"); + OBJLIST &UpdateFiles = *(OBJLIST *)param; if (UpdateFiles.getCount() == 0) { delete &UpdateFiles; @@ -767,6 +771,8 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tsz static void CheckUpdates(void *) { Netlib_LogfT(hNetlibUser, _T("Checking for updates")); + Thread_SetName("PluginUpdater: CheckUpdates"); + TCHAR tszTempPath[MAX_PATH]; DWORD dwLen = GetTempPath(_countof(tszTempPath), tszTempPath); if (tszTempPath[dwLen - 1] == '\\') @@ -887,6 +893,7 @@ void InitTimer(void *type) { if (!opts.bUpdateOnPeriod) return; + Thread_SetName("PluginUpdater: InitTimer"); LONGLONG interval; diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index eff60a4523..0a0c468aaa 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -211,6 +211,8 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA // thread func static unsigned __stdcall PopupThread(void *) { + Thread_SetName("Popup: PopupThread"); + // Create manager window DWORD err; WNDCLASSEX wcl; diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index d48670cef7..9420cf4e77 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -1258,6 +1258,8 @@ LRESULT CALLBACK PopupWnd2::WindowProc(HWND hwnd, UINT message, WPARAM wParam, L void WindowThread(void *arg) { + Thread_SetName("POPUP: WindowThread"); + CoInitialize(NULL); // we may need OLE in this thread for smiley substitution PopupWnd2 *wnd = (PopupWnd2 *)arg; diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 204bfe5c7d..cfb41abe37 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -1035,6 +1035,8 @@ int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth) static void __cdecl phase2(void *lParam) { + Thread_SetName("Scriver: phase2"); + SESSION_INFO *si = (SESSION_INFO*)lParam; Sleep(30); if (si && si->hWnd) diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 08826a6b51..f902e34484 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -507,6 +507,8 @@ void myPlaySound(MCONTACT hcontact, WORD newStatus, WORD oldStatus) // will add hContact to queue and will return position; static void waitThread(void *param) { + Thread_SetName("SeenPlugin: waitThread"); + logthread_info* infoParam = (logthread_info*)param; WORD prevStatus = db_get_w(infoParam->hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE); @@ -636,6 +638,8 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) static void cleanThread(void *param) { + Thread_SetName("SeenPlugin: cleanThread"); + logthread_info* infoParam = (logthread_info*)param; char *szProto = infoParam->sProtoName; diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index f0f052b416..5c39cc3844 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -124,6 +124,8 @@ bool InternetDownloadFile(const char *szUrl, char *szDest, HANDLE &hHttpDwnl) void __cdecl SmileyDownloadThread(void*) { + Thread_SetName("SmileyAdd: SmileyDownloadThread"); + bool needext = false; HANDLE hHttpDwnl = NULL; WaitForSingleObject(g_hDlMutex, 3000); diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp index d297b8eb26..c310abdbd6 100644 --- a/plugins/SmileyAdd/src/smltool.cpp +++ b/plugins/SmileyAdd/src/smltool.cpp @@ -713,6 +713,8 @@ int SmileyToolWindowType::CalculateCoordinatesToButton(POINT pt, int scroll) void __cdecl SmileyToolThread(void *arg) { + Thread_SetName("SmileyAdd: SmileyToolThread"); + SmileyToolWindowParam *stwp = (SmileyToolWindowParam*)arg; if (stwp->pSmileyPack && stwp->pSmileyPack->VisibleSmileyCount()) { WNDCLASSEX wndclass; diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 084297eb78..abe47b5afb 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -223,38 +223,40 @@ void IsMenu() static INT_PTR AdvSt() { - if ((Enabled == 1)){ - POPUPDATAT ppd = {0}; - TCHAR * lptzText =L""; - db_set_b(NULL, "Skin", "UseSound", 0); - EnablePopupModule(); - - if (PopUp == 1) { - lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED; - ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); - ppd.lchContact = NULL; - ppd.iSeconds = PopUpTime; - wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); - lptzText = TranslateT(MENU_NAME); - wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE); - PUAddPopupT(&ppd); - } + Thread_SetName("StartupSilenc: AdvSt"); - timer = 2; - Sleep(delay * 1000); - timer = 0; + if ((Enabled == 1)) { + POPUPDATAT ppd = {0}; + TCHAR * lptzText =L""; + db_set_b(NULL, "Skin", "UseSound", 0); + EnablePopupModule(); + + if (PopUp == 1) { + lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED; + ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); + ppd.lchContact = NULL; + ppd.iSeconds = PopUpTime; + wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); + lptzText = TranslateT(MENU_NAME); + wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE); + PUAddPopupT(&ppd); + } - if (PopUp == 1) { - lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED; - ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); - wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); - PUAddPopupT(&ppd); - } - if (DefEnabled == 1) { //predefined sound setting - db_set_b(NULL, "Skin", "UseSound", DefSound); - } - else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts + timer = 2; + Sleep(delay * 1000); + timer = 0; + + if (PopUp == 1) { + lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED; + ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); + wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); + PUAddPopupT(&ppd); } + if (DefEnabled == 1) { //predefined sound setting + db_set_b(NULL, "Skin", "UseSound", DefSound); + } + else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts + } return 0; } diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index c72083e891..017b1d07de 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -751,6 +751,8 @@ static VOID CALLBACK AfterCheckTimer(HWND, UINT, UINT_PTR, DWORD) static void CheckContinueslyFunction(void *) { + Thread_SetName("KeepStatus: CheckContinueslyFunction"); + static int pingFailures = 0; // one at the time is enough, do it the 'easy' way diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index eab7d769d2..5ecd96eeed 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -1709,6 +1709,8 @@ int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth) static void __cdecl phase2(void * lParam) { + Thread_SetName("TabSRMM: phase2"); + SESSION_INFO *si = (SESSION_INFO*)lParam; Sleep(30); if (si && si->hWnd) diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index be944454c7..249134d490 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -978,6 +978,8 @@ void TSAPI DM_ScrollToBottom(TWindowData *dat, WPARAM wParam, LPARAM lParam) static void LoadKLThread(LPVOID _param) { + Thread_SetName("TabSRMM: LoadKLThread"); + DBVARIANT dbv; if (!db_get_ts((UINT_PTR)_param, SRMSGMOD_T, "locale", &dbv)) { HKL hkl = LoadKeyboardLayout(dbv.ptszVal, 0); diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 345bed18f0..428883a1da 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -119,6 +119,8 @@ entry_found: static void DoSplitSendA(LPVOID param) { + Thread_SetName("TabSRMM: DoSplitSendA"); + SendJob *job = sendQueue->getJobByIndex((INT_PTR)param); size_t iLen = mir_strlen(job->szSendBuffer); diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index b3bb79db7f..caf9715dee 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -37,6 +37,8 @@ static TCHAR g_eventName[100]; static void TrayAnimThread(LPVOID) { + Thread_SetName("TabSRMM: TrayAnimThread"); + int iAnimMode = (PluginConfig.m_AnimTrayIcons[0] && PluginConfig.m_AnimTrayIcons[1] && PluginConfig.m_AnimTrayIcons[2] && PluginConfig.m_AnimTrayIcons[3]); DWORD dwElapsed = 0, dwAnimStep = 0; diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index 949d5d9603..6f6f8d47ef 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -101,6 +101,8 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) unsigned int CALLBACK MessagePumpThread(void*) { + Thread_SetName("TipperYM: MessagePumpThread"); + HWND hwndTip = NULL; CLCINFOTIPEX *clcitex = NULL; MSG hwndMsg = {0}; diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index e541836bbf..46a8a173a6 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -189,6 +189,8 @@ void ShowPopupMessage(const TCHAR *title, const TCHAR *message, HANDLE icon) void __cdecl RefreshUserDetailsWorkerThread(void*) { + Thread_SetName("WhenWasIt: RefreshUserDetailsWorkerThread"); + ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Starting to refresh user details"), hRefreshUserDetails); int delay = db_get_w(NULL, ModuleName, "UpdateDelay", REFRESH_DETAILS_DELAY); diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 22d1a408ae..fb7e734547 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -237,6 +237,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, TCHAR* msg) void __cdecl CIrcProto::ResolveIPThread(LPVOID di) { + Thread_SetName("IRC: ResolveIPThread"); IPRESOLVE* ipr = (IPRESOLVE *)di; { mir_cslock lock(m_resolve); @@ -2382,6 +2383,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) static void __cdecl AwayWarningThread(LPVOID) { + Thread_SetName("IRC: AwayWarningThread"); MessageBox(NULL, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK); } diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index a78383f4a5..8d462b3a17 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -438,6 +438,7 @@ void CIrcProto::DoReceive() void __cdecl CIrcProto::ThreadProc(void*) { + Thread_SetName("IRC: CIrcProto"); DoReceive(); m_info.Reset(); } @@ -836,6 +837,8 @@ int CDccSession::Connect() void __cdecl CDccSession::ConnectProc(void *pparam) { + Thread_SetName("IRC: ConnectProc"); + CDccSession* pThis = (CDccSession*)pparam; if (!pThis->con) pThis->SetupConnection(); @@ -1039,6 +1042,8 @@ int CDccSession::IncomingConnection(HANDLE hConnection, DWORD dwIP) // here we decide which function to use for communicating with the remote computer, depending on connection type void __cdecl CDccSession::ThreadProc(void *pparam) { + Thread_SetName("IRC: CDccSession::ThreadProc"); + CDccSession* pThis = (CDccSession*)pparam; // if it is an incoming connection on a listening port, then we should close the listenting port so only one can connect (the one you offered diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 0f4caf2a54..4e5c156334 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -480,6 +480,8 @@ struct AckBasicSearchParam void __cdecl CIrcProto::AckBasicSearch(void *arg) { + Thread_SetName("IRC: AckBasicSearch"); + AckBasicSearchParam *param = (AckBasicSearchParam*)arg; PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; @@ -658,16 +660,19 @@ struct TFakeAckParam void __cdecl CIrcProto::AckMessageFail(void *info) { + Thread_SetName("IRC: AckMessageFail"); ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The protocol is not online")); } void __cdecl CIrcProto::AckMessageFailDcc(void *info) { + Thread_SetName("IRC: AckMessageFailDcc"); ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The dcc chat connection is not active")); } void __cdecl CIrcProto::AckMessageSuccess(void *info) { + Thread_SetName("IRC: AckMessageSuccess"); TFakeAckParam *param = (TFakeAckParam*)info; ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)param->msgid, 0); delete param; diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index a0c98d3298..b8cd6b6e7b 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -67,6 +67,7 @@ static void __stdcall OnHook(void * pi) static void __cdecl GuiOutThread(LPVOID di) { + Thread_SetName("IRC: GuiOutThread"); GCHOOK* gch = (GCHOOK*)di; CallFunctionAsync(OnHook, (void*)gch); } diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 19909dfc4b..d147b48b2e 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -976,6 +976,8 @@ int __cdecl CIrcProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) } void __cdecl CIrcProto::ConnectServerThread(void*) { + Thread_SetName("IRC: ConnectServer"); + InterlockedIncrement((long *)&m_bConnectThreadRunning); InterlockedIncrement((long *)&m_bConnectRequested); while (!Miranda_Terminated() && m_bConnectRequested > 0) { @@ -1016,6 +1018,8 @@ void __cdecl CIrcProto::ConnectServerThread(void*) void __cdecl CIrcProto::DisconnectServerThread(void*) { + Thread_SetName("IRC: DisconnectServer"); + mir_cslock lck(cs); if (IsConnected()) Disconnect(); diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index a48ba14ee5..c1d1b30564 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -671,6 +671,7 @@ void CIcqProto::requestAvatarConnection() void __cdecl CIcqProto::AvatarThread(avatars_server_connection *pInfo) { debugLogA("%s thread started.", "Avatar"); + Thread_SetName("ICQ: AvatarThread"); // Execute connection handler pInfo->connectionThread(); diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index 7131dc5b70..0cc7a372ea 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -192,6 +192,8 @@ void CIcqProto::CloseDirectConnection(directconnect *dc) void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) { + Thread_SetName("ICQ: directThread"); + directconnect dc = { 0 }; NETLIBPACKETRECVER packetRecv = { 0 }; HANDLE hPacketRecver; diff --git a/protocols/IcqOscarJ/src/icq_infoupdate.cpp b/protocols/IcqOscarJ/src/icq_infoupdate.cpp index 64cbaeb4cd..8e4fc2f753 100644 --- a/protocols/IcqOscarJ/src/icq_infoupdate.cpp +++ b/protocols/IcqOscarJ/src/icq_infoupdate.cpp @@ -151,6 +151,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) DWORD dwWait = WAIT_OBJECT_0; debugLogA("%s thread starting.", "Info-Update"); + Thread_SetName("ICQ: InfoUpdateThread"); bInfoUpdateRunning = TRUE; diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 444772d9f9..12c8b99307 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -716,6 +716,8 @@ void CIcqProto::CheekySearchThread(void*) ICQSEARCHRESULT isr = { 0 }; isr.hdr.cbSize = sizeof(isr); + Thread_SetName("ICQ: CheekySearchThread"); + if (cheekySearchUin) { _itoa(cheekySearchUin, szUin, 10); isr.hdr.id.t = (TCHAR*)szUin; @@ -1633,6 +1635,8 @@ struct status_message_thread_data void __cdecl CIcqProto::GetAwayMsgThread(void *pStatusData) { + Thread_SetName("ICQ: GetAwayMsgThread"); + status_message_thread_data *pThreadData = (status_message_thread_data*)pStatusData; if (pThreadData) { // wait a little diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp index b0e7d20b57..6a130e3b03 100644 --- a/protocols/IcqOscarJ/src/icq_rates.cpp +++ b/protocols/IcqOscarJ/src/icq_rates.cpp @@ -301,6 +301,7 @@ rates_queue::~rates_queue() static void rateDelayThread(void *param) { + Thread_SetName("ICQ: rateDelayThread"); rates_queue *pQueue = (rates_queue*)param; pQueue->handleDelay(); } diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index 3a891b0a5d..87e1007267 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -36,6 +36,8 @@ void icq_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pE void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) { + Thread_SetName("ICQ: ServerThread"); + serverthread_info info = { 0 }; info.isLoginServer = info.bReinitRecver = true; info.wAuthKeyLen = infoParam->wPassLen; @@ -333,6 +335,7 @@ void CIcqProto::sendServPacket(icq_packet *pPacket) void __cdecl CIcqProto::SendPacketAsyncThread(icq_packet* pkt) { + Thread_SetName("ICQ: SendPacketAsyncThread"); sendServPacket( pkt ); SAFE_FREE((void**)&pkt); } diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 1c1ea58350..0769d7b69c 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -65,6 +65,7 @@ void CIcqProto::servlistEndOperation(int operationCount) void __cdecl CIcqProto::servlistQueueThread(void *param) { debugLogA("Server-List: Starting Update board."); + Thread_SetName("ICQ: servlistQueueThread"); int *queueState = (int*)param; SleepEx(50, FALSE); diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 235a752f9c..ee39798610 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -42,6 +42,7 @@ void __cdecl CIcqProto::icq_LogMessageThread(void* arg) LogMessageInfo *err = (LogMessageInfo*)arg; if (!err) return; + Thread_SetName("ICQ: LogMessageThread"); if (bPopupService && getByte("PopupsLogEnabled", DEFAULT_LOG_POPUPS_ENABLED)) { ShowPopupMsg(NULL, err->szTitle, err->szMsg, err->bLevel); diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 6305536dcb..143a1e715e 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -1104,6 +1104,8 @@ void __cdecl CIcqProto::oft_connectionThread(oscarthreadstartinfo *otsi) NETLIBPACKETRECVER packetRecv = { 0 }; HANDLE hPacketRecver; + Thread_SetName("ICQ: oft_connectionThread"); + oc.hContact = otsi->hContact; oc.hConnection = otsi->hConnection; oc.type = otsi->type; diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 26ffc7ed66..85a3c36114 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -906,6 +906,7 @@ bool IsStringUIN(const char *pszString) void __cdecl CIcqProto::ProtocolAckThread(icq_ack_args* pArguments) { + Thread_SetName("ICQ: ProtocolAckThread"); Sleep(150); if (pArguments->nAckResult == ACKRESULT_SUCCESS) @@ -988,6 +989,7 @@ int CIcqProto::IsMetaInfoChanged(MCONTACT hContact) void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) { + Thread_SetName("ICQ: SetStatusNoteThread"); if (pDelay) SleepEx((UINT_PTR)pDelay, TRUE); diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 1861e5240b..02c7e6b611 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -148,6 +148,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) int nIqId = 0; debugLogA("Thread started: type=bytestream_send"); + Thread_SetName("Jabber: ByteSendThread"); BOOL bDirect = m_options.BsDirect; @@ -596,6 +597,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) BOOL validStreamhost = FALSE; if (jbt == NULL) return; + Thread_SetName("Jabber: ByteReceiveThread"); jbt->state = JBT_INIT; diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 4033edb1b7..f0306b9ec4 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -596,6 +596,8 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) void __cdecl CJabberProto::ConsoleThread(void*) { + Thread_SetName("Jabber: ConsoleThread"); + MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { if (msg.message == WM_CREATECONSOLE) { diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index fa45e4a0e2..69951806b0 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -32,6 +32,7 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft) ThreadData info(this, NULL); debugLogA("Thread started: type=file_receive server='%s' port='%d'", ft->httpHostName, ft->httpPort); + Thread_SetName("Jabber: FileReceiveThread"); ft->type = FT_OOB; @@ -234,6 +235,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, void __cdecl CJabberProto::FileServerThread(filetransfer *ft) { debugLogA("Thread started: type=file_send"); + Thread_SetName("Jabber: FileServerThread"); ThreadData info(this, NULL); ft->type = FT_OOB; diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index ae7b45b7ad..0ac2a73150 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -89,6 +89,7 @@ void CJabberProto::OnIbbCloseResult(HXML, CJabberIqInfo *pInfo) void CJabberProto::IbbSendThread(JABBER_IBB_TRANSFER *jibb) { debugLogA("Thread started: type=ibb_send"); + Thread_SetName("Jabber: IbbSendThread"); jibb->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); jibb->bStreamInitialized = FALSE; @@ -134,6 +135,7 @@ void CJabberProto::IbbSendThread(JABBER_IBB_TRANSFER *jibb) void __cdecl CJabberProto::IbbReceiveThread(JABBER_IBB_TRANSFER *jibb) { debugLogA("Thread started: type=ibb_recv"); + Thread_SetName("Jabber: IbbReceiveThread"); filetransfer *ft = jibb->ft; diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index 6149d6d1e9..49192e6613 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -133,12 +133,15 @@ void CJabberIqManager::FillPermanentHandlers() void __cdecl CJabberProto::ExpirerThread(void* pParam) { + Thread_SetName("Jabber: ExpirerThread"); CJabberIqManager *pManager = (CJabberIqManager *)pParam; pManager->ExpirerThread(); } void CJabberIqManager::ExpirerThread() { + Thread_SetName("Jabber: ExpirerThread"); + while (!m_bExpirerThreadShutdownRequest) { CJabberIqInfo *pInfo = DetouchExpired(); if (!pInfo) { diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 71dd2f0eee..40f2b4fb61 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -712,6 +712,8 @@ private: static void QueryServerListThread(void *arg) { + Thread_SetName("Jabber: QueryServerListThread"); + CDlgOptAccount *wnd = (CDlgOptAccount *)arg; HWND hwnd = wnd->GetHwnd(); bool bIsError = true; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 94706e8ca9..327415dab4 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -679,6 +679,7 @@ struct JABBER_SEARCH_BASIC void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb) { + Thread_SetName("Jabber: BasicSearchThread"); Sleep(100); PROTOSEARCHRESULT psr = { 0 }; @@ -938,6 +939,7 @@ struct TFakeAckParams void __cdecl CJabberProto::SendMessageAckThread(void* param) { + Thread_SetName("Jabber: SendMessageAckThread"); TFakeAckParams *par = (TFakeAckParams*)param; Sleep(100); debugLogA("Broadcast ACK"); @@ -1122,6 +1124,8 @@ int __cdecl CJabberProto::SetStatus(int iNewStatus) void __cdecl CJabberProto::GetAwayMsgThread(void *param) { + Thread_SetName("Jabber: GetAwayMsgThread"); + MCONTACT hContact = (DWORD_PTR)param; ptrT jid(getTStringA(hContact, "jid")); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 4ab20dfab0..f4e012174f 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -222,6 +222,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) ThreadData info(this, pParam); debugLogA("Thread started: type=%d", info.bIsReg); + Thread_SetName("Jabber: ServerThread"); if (m_options.ManualConnect == TRUE) { ptrA szManualHost(getStringA("ManualHost")); diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index cb50955c75..ad0e2caf07 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -884,6 +884,8 @@ bool CJabberProto::IsMyOwnJID(LPCTSTR szJID) void __cdecl CJabberProto::LoadHttpAvatars(void* param) { + Thread_SetName("Jabber: LoadHttpAvatars"); + OBJLIST &avs = *(OBJLIST*)param; HANDLE hHttpCon = NULL; for (int i = 0; i < avs.getCount(); i++) { diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 62b329e576..3813da9741 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -159,6 +159,8 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) nls.cbSize = sizeof(nls); + Thread_SetName("MRA: AvatarsThreadProc"); + HANDLE hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL); { mir_cslock lck(pmraaqAvatarsQueue->cs); @@ -432,16 +434,18 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR bool CMraProto::MraAvatarsGetContactTime(MCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime) { - if (lpszValueName && pstTime) { - INTERNET_TIME itAvatarLastModifiedTimeLocal; - CMStringA szBuff; - if (mraGetStringA(hContact, lpszValueName, szBuff)) - if (InternetTimeGetTime(szBuff, itAvatarLastModifiedTimeLocal) == NO_ERROR) { - memcpy(pstTime, &itAvatarLastModifiedTimeLocal.stTime, sizeof(SYSTEMTIME)); - return true; - } - } - return false; + INTERNET_TIME itAvatarLastModifiedTimeLocal; + CMStringA szBuff; + + if (NULL == lpszValueName || + NULL == pstTime) + return false; + if (false == mraGetStringA(hContact, lpszValueName, szBuff)) + return false; + if (InternetTimeGetTime(szBuff, itAvatarLastModifiedTimeLocal) != NO_ERROR) + return false; + memcpy(pstTime, &itAvatarLastModifiedTimeLocal.stTime, sizeof(SYSTEMTIME)); + return true; } void CMraProto::MraAvatarsSetContactTime(MCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime) diff --git a/protocols/MRA/src/MraConstans.h b/protocols/MRA/src/MraConstans.h index a5eb5aa6ff..6b8b391e66 100644 --- a/protocols/MRA/src/MraConstans.h +++ b/protocols/MRA/src/MraConstans.h @@ -184,7 +184,7 @@ static const LPSTR lpcszMailRuDomains[] = #define MRA_DEFAULT_SHOW_ALL_XSTATUSES FALSE /* Do not display some x statuses (like dating) in menu. */ #define MRA_AVT_DEFAULT_ENABLE TRUE -#define MRA_AVT_DEFAULT_WRK_THREAD_COUNTS 4 // hidden +#define MRA_AVT_DEFAULT_WRK_THREAD_COUNTS 1 // hidden #define MRA_AVT_DEFAULT_SERVER "obraz.foto.mail.ru" #define MRA_AVT_DEFAULT_SERVER_PORT 80 #define MRA_AVT_DEFAULT_TIMEOUT_CONN 10 diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index a69fbae0b6..2b860467f0 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -709,6 +709,8 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) { DWORD dwRetErrorCode = NO_ERROR; + Thread_SetName("MRA: FilesQueueRecv"); + if (lpParameter) { MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)((MRA_FILES_THREADPROC_PARAMS*)lpParameter)->hFilesQueueHandle; MRA_FILES_QUEUE_ITEM *dat = ((MRA_FILES_THREADPROC_PARAMS*)lpParameter)->dat; @@ -965,6 +967,8 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) { DWORD dwRetErrorCode = NO_ERROR; + Thread_SetName("MRA: FilesQueueSend"); + if (!lpParameter) return; diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 6f399df52c..b06913d615 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -887,6 +887,7 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode static void FakeThread(void* param) { + Thread_SetName("MRA: ProtoBroadcastAckAsync"); Sleep(100); ACKDATA *ack = (ACKDATA*)param; @@ -935,9 +936,10 @@ CMStringA CopyNumber(const CMStringA &str) { CMStringA res; - for (LPCSTR p = str; *p; p++) - if (*p >= '0' && *p <= '9') - res.AppendChar(*p); + for (LPCSTR p = str; *p; p++) { + if (*p >= '0' && *p <= '9') + res.AppendChar(*p); + } return res; } diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 7026623302..df1b11d455 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -37,6 +37,8 @@ void CMraProto::MraThreadProc(LPVOID) CMStringA szHost; DWORD dwConnectReTryCount, dwCurConnectReTryCount; + Thread_SetName("MRA: ProtoThreadProc"); + SleepEx(100, FALSE);// to prevent high CPU load by some status plugins like allwaysonline dwConnectReTryCount = getDword("ConnectReTryCountMRIM", MRA_DEFAULT_CONN_RETRY_COUNT_MRIM); diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 5678869b52..c834e43ad0 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -124,6 +124,8 @@ uint32_t CToxProto::GetToxFriendNumber(MCONTACT hContact) void CToxProto::LoadFriendList(void*) { + Thread_SetName("TOX: LoadFriendList"); + size_t count = tox_self_get_friend_list_size(toxThread->Tox()); if (count > 0) { diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index a44c1084de..c2c409c3e2 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -42,6 +42,8 @@ struct SendMessageParam void CToxProto::SendMessageAsync(void *arg) { + Thread_SetName("TOX: SendMessageAsync"); + SendMessageParam *param = (SendMessageParam*)arg; int32_t friendNumber = GetToxFriendNumber(param->hContact); @@ -129,6 +131,8 @@ int CToxProto::OnPreCreateMessage(WPARAM, LPARAM lParam) /* STATUS MESSAGE */ void CToxProto::GetStatusMessageAsync(void* arg) { + Thread_SetName("TOX: GetStatusMessageAsync"); + MCONTACT hContact = (UINT_PTR)arg; int32_t friendNumber = GetToxFriendNumber(hContact); diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index bf5e54ccc2..4f68ad3c50 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -249,6 +249,7 @@ void CToxProto::CheckConnection(int &retriesCount) void CToxProto::PollingThread(void*) { debugLogA(__FUNCTION__": entering"); + Thread_SetName("TOX: PollingThread"); Tox_Options *options = GetToxOptions(); if (!options) diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index df15a4ab78..6c99ad123c 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -59,6 +59,8 @@ ToxHexAddress ResolveToxAddressFromDns(const char *dnsQuery) void CToxProto::SearchByNameAsync(void *arg) { + Thread_SetName("TOX: SearchByNameAsync"); + char *query = (char*)arg; char *name = strtok(query, "@"); char *domain = strtok(NULL, ""); @@ -145,6 +147,7 @@ void CToxProto::SearchByNameAsync(void *arg) void CToxProto::SearchFailedAsync(void*) { + Thread_SetName("TOX: SearchFailedAsync"); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HWND)1, 0); } -- cgit v1.2.3