Merge pull request #2953 from lioncash/macro

CommonFuncs: Remove SLEEP macro
This commit is contained in:
Markus Wick 2015-09-04 09:01:11 +02:00
commit 39ab0ebbd3
6 changed files with 9 additions and 16 deletions

View File

@ -4,13 +4,6 @@
#pragma once #pragma once
#ifdef _WIN32
#define SLEEP(x) Sleep(x)
#else
#include <unistd.h>
#define SLEEP(x) usleep(x*1000)
#endif
#ifdef __APPLE__ #ifdef __APPLE__
#include <libkern/OSByteOrder.h> #include <libkern/OSByteOrder.h>
#endif #endif

View File

@ -74,7 +74,8 @@ void GeckoSockServer::GeckoConnectionWaiter()
new_client = std::make_unique<sf::TcpSocket>(); new_client = std::make_unique<sf::TcpSocket>();
} }
SLEEP(1);
Common::SleepCurrentThread(1);
} }
} }

View File

@ -17,6 +17,7 @@
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Thread.h"
#include "Core/HW/WiimoteReal/WiimoteReal.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 // Some hacks that allows disconnects to be detected before connections are handled
// workaround for Wiimote 1 moving to slot 2 on temporary disconnect // workaround for Wiimote 1 moving to slot 2 on temporary disconnect
if (forgot_some) if (forgot_some)
SLEEP(100); Common::SleepCurrentThread(100);
} }
// Find and connect Wiimotes. // Find and connect Wiimotes.
@ -313,12 +314,8 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
} }
SetupDiDestroyDeviceInfoList(device_info); 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) int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts)
{ {
OVERLAPPED hid_overlap_write = OVERLAPPED(); OVERLAPPED hid_overlap_write = OVERLAPPED();

View File

@ -359,7 +359,7 @@ bool Wiimote::PrepareOnThread()
return (IOWrite(mode_report, sizeof(mode_report)) && return (IOWrite(mode_report, sizeof(mode_report)) &&
IOWrite(led_report, sizeof(led_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))); IOWrite(req_status_report, sizeof(req_status_report)));
} }

View File

@ -7,6 +7,7 @@
#include <cstring> #include <cstring>
#include <getopt.h> #include <getopt.h>
#include <string> #include <string>
#include <unistd.h>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Event.h" #include "Common/Event.h"

View File

@ -6,6 +6,7 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/Thread.h"
#include "VideoCommon/Debugger.h" #include "VideoCommon/Debugger.h"
#include "VideoCommon/NativeVertexFormat.h" #include "VideoCommon/NativeVertexFormat.h"
@ -56,7 +57,7 @@ void GFXDebuggerCheckAndPause(bool update)
while ( GFXDebuggerPauseFlag ) while ( GFXDebuggerPauseFlag )
{ {
if (update) GFXDebuggerUpdateScreen(); if (update) GFXDebuggerUpdateScreen();
SLEEP(5); Common::SleepCurrentThread(5);
} }
g_pdebugger->OnContinue(); g_pdebugger->OnContinue();
} }