From 8bfb11ba69d6c35961e8881f7b88d2f7b26c0622 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 11 May 2015 14:35:53 +0000 Subject: minus CreateThread git-svn-id: http://svn.miranda-ng.org/main/trunk@13534 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HistoryStats/src/statistic.cpp | 15 +++++---------- plugins/HistoryStats/src/statistic.h | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'plugins/HistoryStats') diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index d4590f5f9e..e609101d3d 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -1261,8 +1261,7 @@ bool Statistic::createStatistics() utils::centerDialog(m_hWndProgress); UpdateWindow(m_hWndProgress); - DWORD dwThreadID = 0; - HANDLE hThread = CreateThread(NULL, 0, threadProcSteps, this, 0, &dwThreadID); + HANDLE hThread = mir_forkthread(threadProcSteps, (void*)this); bool bDone = false; MSG msg; @@ -1370,7 +1369,7 @@ bool Statistic::createStatisticsSteps() return true; } -DWORD WINAPI Statistic::threadProc(LPVOID lpParameter) +void __cdecl Statistic::threadProc(void *lpParameter) { Statistic* pStats = reinterpret_cast(lpParameter); @@ -1384,18 +1383,15 @@ DWORD WINAPI Statistic::threadProc(LPVOID lpParameter) delete pStats; m_bRunning = false; - return 0; } -DWORD WINAPI Statistic::threadProcSteps(LPVOID lpParameter) +void __cdecl Statistic::threadProcSteps(void *lpParameter) { Statistic* pStats = reinterpret_cast(lpParameter); if (pStats->m_Settings.m_ThreadLowPriority) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); - bool bSuccess = pStats->createStatisticsSteps(); - - return (bSuccess ? 0 : 1); + pStats->createStatisticsSteps(); } INT_PTR CALLBACK Statistic::staticConflictProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -1485,8 +1481,7 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS Statistic *pStats = new Statistic(settings, invokedFrom, hInst); pStats->m_hThreadPushEvent = hEvent; // create worker thread - DWORD dwThreadID = 0; - HANDLE hThread = CreateThread(NULL, 0, threadProc, pStats, 0, &dwThreadID); + HANDLE hThread = mir_forkthread(threadProc, (void*)pStats); // wait for thread to place itself on thread unwind stack if (hThread != NULL) diff --git a/plugins/HistoryStats/src/statistic.h b/plugins/HistoryStats/src/statistic.h index e5ca7e6f4f..cc9e4e4546 100644 --- a/plugins/HistoryStats/src/statistic.h +++ b/plugins/HistoryStats/src/statistic.h @@ -160,8 +160,8 @@ private: explicit Statistic(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst); bool createStatistics(); bool createStatisticsSteps(); - static DWORD WINAPI threadProc(LPVOID lpParameter); - static DWORD WINAPI threadProcSteps(LPVOID lpParameter); + static void __cdecl threadProc(void *lpParameter); + static void __cdecl threadProcSteps(void *lpParameter); public: ~Statistic(); -- cgit v1.2.3