From 0b90f720735c6596d8acc11d7fe5105b31b6313f Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 27 Jan 2011 21:34:37 +0000 Subject: [PATCH] Forgot about some Linux files using Common::Thread git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6934 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/AudioCommon/Src/AlsaSoundStream.cpp | 10 ++++------ Source/Core/AudioCommon/Src/AlsaSoundStream.h | 2 +- Source/Core/AudioCommon/Src/PulseAudioStream.cpp | 10 ++++------ Source/Core/AudioCommon/Src/PulseAudioStream.h | 4 ++-- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp b/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp index 1ba81faf62..5ad6e45390 100644 --- a/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp @@ -33,15 +33,14 @@ AlsaSound::~AlsaSound() delete [] mix_buffer; } -static void *ThreadTrampoline(void *args) +static void ThreadTrampoline(AlsaSound* args) { - reinterpret_cast(args)->SoundLoop(); - return NULL; + args->SoundLoop(); } bool AlsaSound::Start() { - thread = new Common::Thread(&ThreadTrampoline, this); + thread = std::thread(ThreadTrampoline, this); thread_data = 0; return true; } @@ -49,8 +48,7 @@ bool AlsaSound::Start() void AlsaSound::Stop() { thread_data = 1; - delete thread; - thread = NULL; + thread.join(); } void AlsaSound::Update() diff --git a/Source/Core/AudioCommon/Src/AlsaSoundStream.h b/Source/Core/AudioCommon/Src/AlsaSoundStream.h index c763ca1ce0..4eae261727 100644 --- a/Source/Core/AudioCommon/Src/AlsaSoundStream.h +++ b/Source/Core/AudioCommon/Src/AlsaSoundStream.h @@ -52,7 +52,7 @@ private: void AlsaShutdown(); u8 *mix_buffer; - Common::Thread *thread; + std::thread thread; // 0 = continue // 1 = shutdown // 2 = done shutting down. diff --git a/Source/Core/AudioCommon/Src/PulseAudioStream.cpp b/Source/Core/AudioCommon/Src/PulseAudioStream.cpp index afad3a31b1..fd7aa31cfd 100644 --- a/Source/Core/AudioCommon/Src/PulseAudioStream.cpp +++ b/Source/Core/AudioCommon/Src/PulseAudioStream.cpp @@ -35,24 +35,22 @@ PulseAudio::~PulseAudio() delete [] mix_buffer; } -void *PulseAudio::ThreadTrampoline(void *args) +void PulseAudio::ThreadTrampoline(PulseAudio* args) { - ((PulseAudio *)args)->SoundLoop(); - return NULL; + args->SoundLoop(); } bool PulseAudio::Start() { thread_running = true; - thread = new Common::Thread(&ThreadTrampoline, this); + thread = std::thread(ThreadTrampoline, this); return true; } void PulseAudio::Stop() { thread_running = false; - delete thread; - thread = NULL; + thread.join(); } void PulseAudio::Update() diff --git a/Source/Core/AudioCommon/Src/PulseAudioStream.h b/Source/Core/AudioCommon/Src/PulseAudioStream.h index 6a7e82e79f..522e0ae6bb 100644 --- a/Source/Core/AudioCommon/Src/PulseAudioStream.h +++ b/Source/Core/AudioCommon/Src/PulseAudioStream.h @@ -46,7 +46,7 @@ public: private: virtual void SoundLoop(); - static void *ThreadTrampoline(void *args); + static void ThreadTrampoline(PulseAudio* args); bool PulseInit(); void PulseShutdown(); bool Write(const void *data, size_t bytes); @@ -56,7 +56,7 @@ private: static void StreamWriteCB(pa_stream *s, size_t length, void *userdata); u8 *mix_buffer; - Common::Thread *thread; + std::thread thread; volatile bool thread_running; pa_threaded_mainloop *mainloop;