diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-03-05 16:52:43 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-03-05 16:52:43 +0000 |
commit | 3b620119f530681ddffcdfdcabd8a41e426a9e7f (patch) | |
tree | 74abc1402ce108a52480d3c41b1646f95d97c949 /protocols | |
parent | 39c40da99dd0f8fad5832f08f5d57247ee7ef0ae (diff) |
MRA: fix SetStatus() on ForkThreadEx() fail.
git-svn-id: http://svn.miranda-ng.org/main/trunk@8414 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 4fdcebcf40..321c314025 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -8,6 +8,10 @@ DWORD CMraProto::StartConnect() if (!g_dwGlobalPluginRunning)
return ERROR_OPERATION_ABORTED;
+ // поток ещё/уже не работал, поставили статус что работает и запускаем
+ if (InterlockedCompareExchange((volatile LONG*)&m_dwThreadWorkerRunning, TRUE, FALSE))
+ return 0;
+
CMStringA szEmail;
mraGetStringA(NULL, "e-mail", szEmail);
@@ -17,13 +21,12 @@ DWORD CMraProto::StartConnect() else if (!GetPassDB(szPass))
MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, 0, TranslateT("Please, setup password in options"));
else {
- // поток ещё/уже не работал, поставили статус что работает и запускаем
- if (InterlockedCompareExchange((volatile LONG*)&m_dwThreadWorkerRunning, TRUE, FALSE))
- return 0;
InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount());
- ForkThreadEx(&CMraProto::MraThreadProc, NULL, 0);
+ if (INVALID_HANDLE_VALUE == ForkThreadEx(&CMraProto::MraThreadProc, NULL, 0)) /* Thread create fail. */
+ MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, TranslateT("Thread create fail"));
return 0;
}
+ InterlockedExchange((volatile LONG*)&m_dwThreadWorkerRunning, FALSE);
return ERROR_OPERATION_ABORTED;
}
|