Moving threads to XHostThread and making shutdown not crash.

This commit is contained in:
Ben Vanik
2015-05-19 22:20:49 -07:00
parent 7a82ad839a
commit f88bf33b4f
22 changed files with 175 additions and 138 deletions

View File

@@ -14,7 +14,6 @@
#include <functional>
#include <memory>
#include <queue>
#include <thread>
#include <unordered_map>
#include <vector>
@@ -28,6 +27,12 @@
#include "xenia/gpu/xenos.h"
#include "xenia/memory.h"
namespace xe {
namespace kernel {
class XHostThread;
} // namespace kernel
} // namespace xe
namespace xe {
namespace gpu {
namespace gl4 {
@@ -134,7 +139,7 @@ class CommandProcessor {
} handles;
};
void WorkerMain();
void WorkerThreadMain();
bool SetupGL();
void ShutdownGL();
GLuint CreateGeometryProgram(const std::string& source);
@@ -226,8 +231,9 @@ class CommandProcessor {
TraceState trace_state_;
std::wstring trace_frame_path_;
std::thread worker_thread_;
std::atomic<bool> worker_running_;
kernel::XHostThread* worker_thread_;
std::unique_ptr<GLContext> context_;
SwapHandler swap_handler_;
std::queue<std::function<void()>> pending_fns_;