diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-11 13:43:44 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-11 13:43:44 +0000 |
commit | 99b0796eb6cd0bcc7d7facdd1a1a6834cca588dd (patch) | |
tree | cda401c44fc86b6eeb73cab594d682150e5b5c94 /plugins/Clist_modern/src/modern_awaymsg.cpp | |
parent | f01a47f097c67d7636cda151e0681a4eb538aa32 (diff) |
various mir_forkthread quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@3975 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src/modern_awaymsg.cpp')
-rw-r--r-- | plugins/Clist_modern/src/modern_awaymsg.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index a03e61bec2..4c6241c18e 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -53,7 +53,6 @@ static DWORD amRequestTick = 0; static int amAddHandleToChain(HANDLE hContact);
static HANDLE amGetCurrentChain();
-static int amThreadProc(HWND hwnd);
/*
* Add contact handle to requests queue
@@ -116,7 +115,7 @@ static HANDLE amGetCurrentChain() /*
* Tread sub to ask protocol to retrieve away message
*/
-static int amThreadProc(HWND hwnd)
+static unsigned __stdcall amThreadProc(void *)
{
DWORD time;
HANDLE hContact;
@@ -127,14 +126,11 @@ static int amThreadProc(HWND hwnd) while (!MirandaExiting())
{
hContact = amGetCurrentChain();
- while (hContact)
- {
+ while (hContact) {
time = GetTickCount();
- if ((time-amRequestTick) < AMASKPERIOD)
- {
+ if ((time-amRequestTick) < AMASKPERIOD) {
SleepEx(AMASKPERIOD-(time-amRequestTick)+10, TRUE);
- if (MirandaExiting())
- {
+ if (MirandaExiting()) {
g_dwAwayMsgThreadID = 0;
return 0;
}
@@ -144,8 +140,7 @@ static int amThreadProc(HWND hwnd) Sync(CLUI_SyncGetPDNCE, (WPARAM) 0, (LPARAM)&dnce);
if (dnce.ApparentMode != ID_STATUS_OFFLINE) //don't ask if contact is always invisible (should be done with protocol)
ACK = (HANDLE)CallContactService(hContact,PSS_GETAWAYMSG, 0, 0);
- if ( !ACK)
- {
+ if ( !ACK) {
ACKDATA ack;
ack.hContact = hContact;
ack.type = ACKTYPE_AWAYMSG;
@@ -159,18 +154,16 @@ static int amThreadProc(HWND hwnd) CListSettings_FreeCacheItemData(&dnce);
amRequestTick = time;
hContact = amGetCurrentChain();
- if (hContact)
- {
+ if (hContact) {
DWORD i=0;
- do
- {
+ do {
i++;
SleepEx(50, TRUE);
- } while (i < AMASKPERIOD/50 && !MirandaExiting());
+ }
+ while (i < AMASKPERIOD/50 && !MirandaExiting());
}
else break;
- if (MirandaExiting())
- {
+ if (MirandaExiting()) {
g_dwAwayMsgThreadID = 0;
return 0;
}
@@ -216,7 +209,7 @@ void InitAwayMsgModule() {
InitializeCriticalSection(&amLockChain);
hamProcessEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
- g_dwAwayMsgThreadID = (DWORD)mir_forkthread((pThreadFunc)amThreadProc,0);
+ mir_forkthreadex(amThreadProc, 0, &g_dwAwayMsgThreadID);
}
void UninitAwayMsgModule()
|