Removing xe_thread_t.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <xenia/gpu/graphics_system.h>
|
||||
|
||||
#include <poly/threading.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/cpu/processor.h>
|
||||
#include <xenia/gpu/command_processor.h>
|
||||
@@ -25,7 +26,7 @@ using namespace xe::gpu::xenos;
|
||||
|
||||
GraphicsSystem::GraphicsSystem(Emulator* emulator) :
|
||||
emulator_(emulator), memory_(emulator->memory()),
|
||||
thread_(nullptr), running_(false), driver_(nullptr),
|
||||
running_(false), driver_(nullptr),
|
||||
command_processor_(nullptr),
|
||||
interrupt_callback_(0), interrupt_callback_data_(0),
|
||||
last_interrupt_time_(0), thread_wait_(nullptr) {
|
||||
@@ -59,15 +60,15 @@ X_STATUS GraphicsSystem::Setup() {
|
||||
// Init needs to happen there so that any thread-local stuff
|
||||
// is created on the right thread.
|
||||
running_ = true;
|
||||
thread_ = xe_thread_create(
|
||||
"GraphicsSystem",
|
||||
(xe_thread_callback)ThreadStartThunk, this);
|
||||
xe_thread_start(thread_);
|
||||
thread_ = std::thread(std::bind(&GraphicsSystem::ThreadStart, this));
|
||||
WaitForSingleObject(thread_wait_, INFINITE);
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
void GraphicsSystem::ThreadStart() {
|
||||
poly::threading::set_name("GraphicsSystemThread");
|
||||
xe::Profiler::ThreadEnter("GraphicsSystemThread");
|
||||
|
||||
xe_run_loop_ref run_loop = xe_run_loop_retain(run_loop_);
|
||||
|
||||
// Initialize driver and ringbuffer.
|
||||
@@ -101,6 +102,8 @@ void GraphicsSystem::ThreadStart() {
|
||||
running_ = false;
|
||||
|
||||
xe_run_loop_release(run_loop);
|
||||
|
||||
xe::Profiler::ThreadExit();
|
||||
}
|
||||
|
||||
void GraphicsSystem::Initialize() {
|
||||
@@ -108,8 +111,7 @@ void GraphicsSystem::Initialize() {
|
||||
|
||||
void GraphicsSystem::Shutdown() {
|
||||
running_ = false;
|
||||
xe_thread_join(thread_);
|
||||
xe_thread_release(thread_);
|
||||
thread_.join();
|
||||
|
||||
delete command_processor_;
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#ifndef XENIA_GPU_GRAPHICS_SYSTEM_H_
|
||||
#define XENIA_GPU_GRAPHICS_SYSTEM_H_
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
@@ -52,9 +55,6 @@ protected:
|
||||
virtual void Pump() = 0;
|
||||
|
||||
private:
|
||||
static void ThreadStartThunk(GraphicsSystem* this_ptr) {
|
||||
this_ptr->ThreadStart();
|
||||
}
|
||||
void ThreadStart();
|
||||
|
||||
static uint64_t MMIOReadRegisterThunk(GraphicsSystem* gs, uint64_t addr) {
|
||||
@@ -73,8 +73,8 @@ protected:
|
||||
cpu::Processor* processor_;
|
||||
|
||||
xe_run_loop_ref run_loop_;
|
||||
xe_thread_ref thread_;
|
||||
bool running_;
|
||||
std::thread thread_;
|
||||
std::atomic<bool> running_;
|
||||
|
||||
GraphicsDriver* driver_;
|
||||
CommandProcessor* command_processor_;
|
||||
|
||||
Reference in New Issue
Block a user