Wait for graphics driver to complete initialization before continuing.
This commit is contained in:
parent
8ae6053d0f
commit
b6c831c7ec
|
@ -26,13 +26,16 @@ GraphicsSystem::GraphicsSystem(Emulator* emulator) :
|
||||||
emulator_(emulator), memory_(emulator->memory()),
|
emulator_(emulator), memory_(emulator->memory()),
|
||||||
thread_(0), running_(false), driver_(0), worker_(0),
|
thread_(0), running_(false), driver_(0), worker_(0),
|
||||||
interrupt_callback_(0), interrupt_callback_data_(0),
|
interrupt_callback_(0), interrupt_callback_data_(0),
|
||||||
last_interrupt_time_(0), swap_pending_(false) {
|
last_interrupt_time_(0), swap_pending_(false),
|
||||||
|
thread_wait_(NULL) {
|
||||||
// Create the run loop used for any windows/etc.
|
// Create the run loop used for any windows/etc.
|
||||||
// This must be done on the thread we create the driver.
|
// This must be done on the thread we create the driver.
|
||||||
run_loop_ = xe_run_loop_create();
|
run_loop_ = xe_run_loop_create();
|
||||||
|
thread_wait_ = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsSystem::~GraphicsSystem() {
|
GraphicsSystem::~GraphicsSystem() {
|
||||||
|
CloseHandle(thread_wait_);
|
||||||
}
|
}
|
||||||
|
|
||||||
X_STATUS GraphicsSystem::Setup() {
|
X_STATUS GraphicsSystem::Setup() {
|
||||||
|
@ -58,7 +61,7 @@ X_STATUS GraphicsSystem::Setup() {
|
||||||
"GraphicsSystem",
|
"GraphicsSystem",
|
||||||
(xe_thread_callback)ThreadStartThunk, this);
|
(xe_thread_callback)ThreadStartThunk, this);
|
||||||
xe_thread_start(thread_);
|
xe_thread_start(thread_);
|
||||||
|
WaitForSingleObject(thread_wait_, INFINITE);
|
||||||
return X_STATUS_SUCCESS;
|
return X_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +71,7 @@ void GraphicsSystem::ThreadStart() {
|
||||||
// Initialize driver and ringbuffer.
|
// Initialize driver and ringbuffer.
|
||||||
Initialize();
|
Initialize();
|
||||||
XEASSERTNOTNULL(driver_);
|
XEASSERTNOTNULL(driver_);
|
||||||
|
SetEvent(thread_wait_);
|
||||||
|
|
||||||
// Main run loop.
|
// Main run loop.
|
||||||
while (running_) {
|
while (running_) {
|
||||||
|
|
|
@ -88,6 +88,7 @@ protected:
|
||||||
uint32_t interrupt_callback_data_;
|
uint32_t interrupt_callback_data_;
|
||||||
double last_interrupt_time_;
|
double last_interrupt_time_;
|
||||||
bool swap_pending_;
|
bool swap_pending_;
|
||||||
|
HANDLE thread_wait_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue