Fixing some shutdown code.

This commit is contained in:
Ben Vanik
2014-01-02 18:58:44 -08:00
parent 125e7278c6
commit 7969349126
11 changed files with 58 additions and 35 deletions

View File

@@ -28,11 +28,6 @@ AudioSystem::AudioSystem(Emulator* emulator) :
}
AudioSystem::~AudioSystem() {
// TODO(benvanik): thread join.
running_ = false;
xe_thread_release(thread_);
xe_run_loop_release(run_loop_);
}
X_STATUS AudioSystem::Setup() {
@@ -80,13 +75,15 @@ void AudioSystem::ThreadStart() {
//worker_->Pump();
Sleep(1000);
if (!running_) {
break;
}
// Pump audio system.
Pump();
}
running_ = false;
Shutdown();
xe_run_loop_release(run_loop);
// TODO(benvanik): call module API to kill?
@@ -96,6 +93,11 @@ void AudioSystem::Initialize() {
}
void AudioSystem::Shutdown() {
running_ = false;
xe_thread_join(thread_);
xe_thread_release(thread_);
xe_run_loop_release(run_loop_);
}
bool AudioSystem::HandlesRegister(uint64_t addr) {