diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp
index 319e8c90e4..bf482504d9 100644
--- a/pcsx2/Counters.cpp
+++ b/pcsx2/Counters.cpp
@@ -26,7 +26,6 @@
#include "GS.h"
#include "VUmicro.h"
-#include "ps2/CoreEmuThread.h"
using namespace Threading;
diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp
index 47be5654bf..7104e66de8 100644
--- a/pcsx2/System.cpp
+++ b/pcsx2/System.cpp
@@ -27,7 +27,6 @@
#include "R5900Exceptions.h"
#include "CDVD/CDVD.h"
-#include "ps2/CoreEmuThread.h"
#if _MSC_VER
# include "svnrev.h"
diff --git a/pcsx2/System/SysThreads.h b/pcsx2/System/SysThreads.h
new file mode 100644
index 0000000000..6eb82fff18
--- /dev/null
+++ b/pcsx2/System/SysThreads.h
@@ -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 .
+ */
+
+#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();
+};
diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h
index a902f55f7e..1ea20d680a 100644
--- a/pcsx2/gui/App.h
+++ b/pcsx2/gui/App.h
@@ -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 )
diff --git a/pcsx2/ps2/CoreEmuThread.h b/pcsx2/ps2/CoreEmuThread.h
deleted file mode 100644
index 07a1a60c24..0000000000
--- a/pcsx2/ps2/CoreEmuThread.h
+++ /dev/null
@@ -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 .
- */
-
-#pragma once
-
-#include "SysThreads.h"