Fix compilation errors from my prev commit.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1910 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-09-23 11:51:41 +00:00
parent 4a1b52a22a
commit fd7e17b5df
5 changed files with 111 additions and 23 deletions

View File

@ -26,7 +26,6 @@
#include "GS.h"
#include "VUmicro.h"
#include "ps2/CoreEmuThread.h"
using namespace Threading;

View File

@ -27,7 +27,6 @@
#include "R5900Exceptions.h"
#include "CDVD/CDVD.h"
#include "ps2/CoreEmuThread.h"
#if _MSC_VER
# include "svnrev.h"

110
pcsx2/System/SysThreads.h Normal file
View File

@ -0,0 +1,110 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Utilities/Threading.h"
using namespace Threading;
class SysSuspendableThread : public PersistentThread
{
typedef PersistentThread _parent;
protected:
enum ExecutionMode
{
ExecMode_NoThreadYet,
ExecMode_Running,
ExecMode_Suspending,
ExecMode_Suspended
};
volatile ExecutionMode m_ExecMode;
MutexLock m_lock_ExecMode;
Semaphore m_ResumeEvent;
Semaphore m_SuspendEvent;
bool m_ResumeProtection;
public:
explicit SysSuspendableThread();
virtual ~SysSuspendableThread() throw();
bool IsSuspended() const { return (m_ExecMode == ExecMode_Suspended); }
virtual void Suspend( bool isBlocking = true );
virtual void Resume();
virtual void StateCheck( bool isCancelable = true );
virtual void DoThreadCleanup();
// This function is called by Resume immediately prior to releasing the suspension of
// the core emulation thread. You should overload this rather than Resume(), since
// Resume() has a lot of checks and balances to prevent re-entrance and race conditions.
virtual void OnResumeReady() {}
protected:
// Marked as protected because user code should call Resume instead, which performs
// a thread-safe check/init/resume procedure.
virtual void Start();
// Extending classes should implement this, but should not call it. The parent class
// handles invocation by the following guidelines: Called *in thread* from StateCheck()
// prior to suspending the thread (ie, when Suspend() has been called on a separate
// thread, requesting this thread suspend itself temporarily). After this is called,
// the thread enters a waiting state on the m_ResumeEvent semaphore.
virtual void OnSuspendInThread()=0;
// Extending classes should implement this, but should not call it. The parent class
// handles invocation by the following guidelines: Called from StateCheck() after the
// thread has been suspended and then subsequently resumed.
virtual void OnResumeInThread()=0;
};
// --------------------------------------------------------------------------------------
// EECoreThread class
// --------------------------------------------------------------------------------------
class SysCoreThread : public SysSuspendableThread
{
typedef SysSuspendableThread _parent;
protected:
bool m_resetRecompilers;
bool m_resetProfilers;
bool m_shortSuspend;
PluginManager& m_plugins;
public:
static SysCoreThread& Get();
public:
explicit SysCoreThread( PluginManager& plugins );
virtual ~SysCoreThread() throw();
virtual void ApplySettings( const Pcsx2Config& src );
virtual void DoThreadCleanup();
virtual void ShortSuspend();
virtual void OnResumeReady();
protected:
void CpuInitializeMess();
void CpuExecute();
virtual void Start();
virtual void OnSuspendInThread();
virtual void OnResumeInThread();
virtual sptr ExecuteTask();
};

View File

@ -32,9 +32,7 @@ class PipeRedirectionBase;
#include "AppConfig.h"
#include "System.h"
//#include "ConsoleLogger.h"
#include "ps2/CoreEmuThread.h"
#include "System/SysThreads.h"
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE( pxEVT_SemaphorePing, -1 )

View File

@ -1,18 +0,0 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "SysThreads.h"