From a11ae2cf300a8049f72ce523f1daac0dc4a49faa Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Sep 2015 02:14:10 -0400 Subject: [PATCH] CommonFuncs: Remove SLEEP macro There's already a function in Thread for this. --- Source/Core/Common/CommonFuncs.h | 7 ------- Source/Core/Core/HW/EXI_DeviceGecko.cpp | 3 ++- Source/Core/Core/HW/WiimoteReal/IOWin.cpp | 9 +++------ Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 2 +- Source/Core/DolphinWX/MainNoGUI.cpp | 1 + Source/Core/VideoCommon/Debugger.cpp | 3 ++- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h index 1eb57842cd..21032e6921 100644 --- a/Source/Core/Common/CommonFuncs.h +++ b/Source/Core/Common/CommonFuncs.h @@ -4,13 +4,6 @@ #pragma once -#ifdef _WIN32 -#define SLEEP(x) Sleep(x) -#else -#include -#define SLEEP(x) usleep(x*1000) -#endif - #ifdef __APPLE__ #include #endif diff --git a/Source/Core/Core/HW/EXI_DeviceGecko.cpp b/Source/Core/Core/HW/EXI_DeviceGecko.cpp index 767ef9b785..a189568ae7 100644 --- a/Source/Core/Core/HW/EXI_DeviceGecko.cpp +++ b/Source/Core/Core/HW/EXI_DeviceGecko.cpp @@ -74,7 +74,8 @@ void GeckoSockServer::GeckoConnectionWaiter() new_client = std::make_unique(); } - SLEEP(1); + + Common::SleepCurrentThread(1); } } diff --git a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp index 4f9402e2ac..3e3ce00c83 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp @@ -17,6 +17,7 @@ #include "Common/Common.h" #include "Common/StringUtil.h" +#include "Common/Thread.h" #include "Core/HW/WiimoteReal/WiimoteReal.h" @@ -250,7 +251,7 @@ void WiimoteScanner::Update() // Some hacks that allows disconnects to be detected before connections are handled // workaround for Wiimote 1 moving to slot 2 on temporary disconnect if (forgot_some) - SLEEP(100); + Common::SleepCurrentThread(100); } // Find and connect Wiimotes. @@ -313,12 +314,8 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot } SetupDiDestroyDeviceInfoList(device_info); - - // Don't mind me, just a random sleep to fix stuff on Windows - //if (!wiimotes.empty()) - // SLEEP(2000); - } + int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts) { OVERLAPPED hid_overlap_write = OVERLAPPED(); diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index 5675436c75..8022efff09 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -359,7 +359,7 @@ bool Wiimote::PrepareOnThread() return (IOWrite(mode_report, sizeof(mode_report)) && IOWrite(led_report, sizeof(led_report)) && - (SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report))) && + (Common::SleepCurrentThread(200), IOWrite(rumble_report, sizeof(rumble_report))) && IOWrite(req_status_report, sizeof(req_status_report))); } diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index 5d50423f0a..5b46e207e5 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "Common/CommonTypes.h" #include "Common/Event.h" diff --git a/Source/Core/VideoCommon/Debugger.cpp b/Source/Core/VideoCommon/Debugger.cpp index 0c88be57f5..755293b26c 100644 --- a/Source/Core/VideoCommon/Debugger.cpp +++ b/Source/Core/VideoCommon/Debugger.cpp @@ -6,6 +6,7 @@ #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Common/Thread.h" #include "VideoCommon/Debugger.h" #include "VideoCommon/NativeVertexFormat.h" @@ -56,7 +57,7 @@ void GFXDebuggerCheckAndPause(bool update) while ( GFXDebuggerPauseFlag ) { if (update) GFXDebuggerUpdateScreen(); - SLEEP(5); + Common::SleepCurrentThread(5); } g_pdebugger->OnContinue(); }