summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp6
-rw-r--r--plugins/Clist_nicer/src/contact.cpp43
2 files changed, 24 insertions, 25 deletions
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index e15a91409b..c63cd319d7 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -30,9 +30,10 @@ HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHei
extern HWND g_hwndViewModeFrame, g_hwndEventArea;
extern int mf_updatethread_running;
-extern DWORD WINAPI MF_UpdateThread(LPVOID p);
extern HANDLE hThreadMFUpdate;;
+void MF_UpdateThread(LPVOID);
+
HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent;
HANDLE g_hEventThread = 0;
@@ -3280,7 +3281,7 @@ static int CLUIFrameOnModulesLoad(WPARAM wParam, LPARAM lParam)
{
mir_sntprintf(g_ptszEventName, SIZEOF(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId());
g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName);
- hThreadMFUpdate = (HANDLE)mir_forkthreadex(reinterpret_cast<pThreadFuncEx>(MF_UpdateThread), NULL, NULL);
+ hThreadMFUpdate = mir_forkthread(MF_UpdateThread, NULL);
SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE);
CLUIFramesLoadMainMenu();
CLUIFramesCreateMenuForFrame(-1, -1, 000010000, Menu_AddContextFrameMenuItem);
@@ -3294,7 +3295,6 @@ static int CLUIFrameOnModulesUnload(WPARAM wParam, LPARAM lParam)
SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_NORMAL);
SetEvent(g_hEventThread);
WaitForSingleObject(hThreadMFUpdate, 2000);
- CloseHandle(hThreadMFUpdate);
CloseHandle(g_hEventThread);
CallService(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, (LPARAM)contMIVisible, 0);
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp
index d4a0188164..672c10b3bb 100644
--- a/plugins/Clist_nicer/src/contact.cpp
+++ b/plugins/Clist_nicer/src/contact.cpp
@@ -114,29 +114,28 @@ static void MF_CalcFrequency(HANDLE hContact, DWORD dwCutoffDays, int doSleep)
extern TCHAR g_ptszEventName[];
-DWORD WINAPI MF_UpdateThread(LPVOID p)
+void MF_UpdateThread(LPVOID)
{
- HANDLE hContact;
- HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, g_ptszEventName);
-
- WaitForSingleObject(hEvent, 20000);
- ResetEvent(hEvent);
-
- while(mf_updatethread_running) {
- hContact = db_find_first();
- while (hContact != NULL && mf_updatethread_running) {
- MF_CalcFrequency(hContact, 50, 1);
- if (mf_updatethread_running)
- WaitForSingleObject(hEvent, 5000);
- ResetEvent(hEvent);
- hContact = db_find_next(hContact);
- }
- if (mf_updatethread_running)
- WaitForSingleObject(hEvent, 1000000);
- ResetEvent(hEvent);
- }
- CloseHandle(hEvent);
- return 0;
+ HANDLE hContact;
+ HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, g_ptszEventName);
+
+ WaitForSingleObject(hEvent, 20000);
+ ResetEvent(hEvent);
+
+ while(mf_updatethread_running) {
+ hContact = db_find_first();
+ while (hContact != NULL && mf_updatethread_running) {
+ MF_CalcFrequency(hContact, 50, 1);
+ if (mf_updatethread_running)
+ WaitForSingleObject(hEvent, 5000);
+ ResetEvent(hEvent);
+ hContact = db_find_next(hContact);
+ }
+ if (mf_updatethread_running)
+ WaitForSingleObject(hEvent, 1000000);
+ ResetEvent(hEvent);
+ }
+ CloseHandle(hEvent);
}
static BOOL mc_hgh_removed = FALSE;