2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
2009-10-05 11:05:11 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
2009-10-05 11:05:11 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-07-03 20:48:11 +00:00
|
|
|
#include "../PrecompiledHeader.h"
|
2009-07-03 00:49:40 +00:00
|
|
|
#include "Threading.h"
|
2009-07-03 20:12:33 +00:00
|
|
|
#include "x86emitter/tools.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// Note: assuming multicore is safer because it forces the interlocked routines to use
|
|
|
|
// the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not
|
|
|
|
// having the LOCK prefix is very bad indeed.
|
|
|
|
|
2009-10-19 23:13:22 +00:00
|
|
|
__forceinline void Threading::Sleep( int ms )
|
|
|
|
{
|
|
|
|
usleep( 1000*ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
// For use in spin/wait loops, Acts as a hint to Intel CPUs and should, in theory
|
|
|
|
// improve performance and reduce cpu power consumption.
|
|
|
|
__forceinline void Threading::SpinWait()
|
|
|
|
{
|
|
|
|
// If this doesn't compile you can just comment it out (it only serves as a
|
|
|
|
// performance hint and isn't required).
|
|
|
|
__asm__ ( "pause" );
|
|
|
|
}
|
|
|
|
|
|
|
|
__forceinline void Threading::EnableHiresScheduler()
|
|
|
|
{
|
|
|
|
// Don't know if linux has a customizable scheduler resolution like Windows (doubtful)
|
|
|
|
}
|
|
|
|
|
|
|
|
__forceinline void Threading::DisableHiresScheduler()
|
|
|
|
{
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|