Forgot about some Linux files using Common::Thread

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6934 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak 2011-01-27 21:34:37 +00:00
parent 2c05c49a04
commit 0b90f72073
4 changed files with 11 additions and 15 deletions

View File

@ -33,15 +33,14 @@ AlsaSound::~AlsaSound()
delete [] mix_buffer; delete [] mix_buffer;
} }
static void *ThreadTrampoline(void *args) static void ThreadTrampoline(AlsaSound* args)
{ {
reinterpret_cast<AlsaSound *>(args)->SoundLoop(); args->SoundLoop();
return NULL;
} }
bool AlsaSound::Start() bool AlsaSound::Start()
{ {
thread = new Common::Thread(&ThreadTrampoline, this); thread = std::thread(ThreadTrampoline, this);
thread_data = 0; thread_data = 0;
return true; return true;
} }
@ -49,8 +48,7 @@ bool AlsaSound::Start()
void AlsaSound::Stop() void AlsaSound::Stop()
{ {
thread_data = 1; thread_data = 1;
delete thread; thread.join();
thread = NULL;
} }
void AlsaSound::Update() void AlsaSound::Update()

View File

@ -52,7 +52,7 @@ private:
void AlsaShutdown(); void AlsaShutdown();
u8 *mix_buffer; u8 *mix_buffer;
Common::Thread *thread; std::thread thread;
// 0 = continue // 0 = continue
// 1 = shutdown // 1 = shutdown
// 2 = done shutting down. // 2 = done shutting down.

View File

@ -35,24 +35,22 @@ PulseAudio::~PulseAudio()
delete [] mix_buffer; delete [] mix_buffer;
} }
void *PulseAudio::ThreadTrampoline(void *args) void PulseAudio::ThreadTrampoline(PulseAudio* args)
{ {
((PulseAudio *)args)->SoundLoop(); args->SoundLoop();
return NULL;
} }
bool PulseAudio::Start() bool PulseAudio::Start()
{ {
thread_running = true; thread_running = true;
thread = new Common::Thread(&ThreadTrampoline, this); thread = std::thread(ThreadTrampoline, this);
return true; return true;
} }
void PulseAudio::Stop() void PulseAudio::Stop()
{ {
thread_running = false; thread_running = false;
delete thread; thread.join();
thread = NULL;
} }
void PulseAudio::Update() void PulseAudio::Update()

View File

@ -46,7 +46,7 @@ public:
private: private:
virtual void SoundLoop(); virtual void SoundLoop();
static void *ThreadTrampoline(void *args); static void ThreadTrampoline(PulseAudio* args);
bool PulseInit(); bool PulseInit();
void PulseShutdown(); void PulseShutdown();
bool Write(const void *data, size_t bytes); bool Write(const void *data, size_t bytes);
@ -56,7 +56,7 @@ private:
static void StreamWriteCB(pa_stream *s, size_t length, void *userdata); static void StreamWriteCB(pa_stream *s, size_t length, void *userdata);
u8 *mix_buffer; u8 *mix_buffer;
Common::Thread *thread; std::thread thread;
volatile bool thread_running; volatile bool thread_running;
pa_threaded_mainloop *mainloop; pa_threaded_mainloop *mainloop;