From 51ede24c4c00a3fe3f65139dd2522d78d5a1e55b Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 11 May 2015 14:55:41 +0000 Subject: minus CreateThread git-svn-id: http://svn.miranda-ng.org/main/trunk@13538 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NotifyAnything/src/main.cpp | 15 +++++++-------- plugins/NotifyAnything/src/options.cpp | 10 +++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index ee521e7550..35cc173008 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -845,7 +845,7 @@ void initWinsock() } } -DWORD WINAPI udptcpThreadFunc(LPVOID useUdp) +void __cdecl udptcpThreadFunc(void *useUdp) { try { @@ -883,7 +883,7 @@ DWORD WINAPI udptcpThreadFunc(LPVOID useUdp) int err = recvfrom(sock, buf, sizeof buf - 1, 0, reinterpret_cast(&from), &fromSize); if (g_exit_threads) - return 0; + return; if (err == SOCKET_ERROR) throw "socket error"; @@ -901,7 +901,7 @@ DWORD WINAPI udptcpThreadFunc(LPVOID useUdp) SOCKET msgsock = accept(sock, reinterpret_cast(&from), &fromSize); if (g_exit_threads) - return 0; + return; if (msgsock == INVALID_SOCKET) throw "socket error"; @@ -926,7 +926,7 @@ DWORD WINAPI udptcpThreadFunc(LPVOID useUdp) processMessage((TCHAR*)_A2T(buf)); } } - return 0; + return; } catch (const char *err) { std::string t = err; @@ -949,16 +949,15 @@ DWORD WINAPI udptcpThreadFunc(LPVOID useUdp) t += buf; MessageBoxA(0, t.c_str(), Translate("Error"), MB_OK); - return 1; + return; } } void start_threads() { g_exit_threads = false; - DWORD id; - g_udp_thread = CreateThread(NULL, 0, udptcpThreadFunc, (void *)1, 0, &id); - g_tcp_thread = CreateThread(NULL, 0, udptcpThreadFunc, NULL, 0, &id); + g_udp_thread = mir_forkthread(udptcpThreadFunc, (void *)1); + g_tcp_thread = mir_forkthread(udptcpThreadFunc, 0); } void stop_threads() diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index 577e0f560b..51ceaef1df 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -7,20 +7,20 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - if(g_settings.local_only) { + if (g_settings.local_only) { CheckDlgButton(hwndDlg, NA_LOCAL_CHECK, BST_CHECKED); } - if(g_settings.log_to_file) { + if (g_settings.log_to_file) { CheckDlgButton(hwndDlg, NA_LOG_CHECK, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, NA_DEBUG_MSG_CHECK), TRUE); } - if(g_settings.debug_messages) { + if (g_settings.debug_messages) { CheckDlgButton(hwndDlg, NA_DEBUG_MSG_CHECK, BST_CHECKED); } - if(g_settings.use_pcspeaker) { + if (g_settings.use_pcspeaker) { CheckDlgButton(hwndDlg, NA_PCSPEAKER_CHECK, BST_CHECKED); } - if(g_settings.allow_execute) { + if (g_settings.allow_execute) { CheckDlgButton(hwndDlg, NA_ALLOW_EXECUTE, BST_CHECKED); } -- cgit v1.2.3