mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-11 16:49:28 +02:00
Replaced Common::Thread with a partial implementation of std::thread. (rvalue references are used if available, <thread> is used if possible) Eliminates the need to use dynamic memory allocation for threads, so it's impossible to forget to delete a thread or set a pointer to NULL. Enables use of type-safe thread functions, no need to cast to and from void*. I've made sure the code compiles in vs08 and tested the functionality of "StdThread.h" on Linux so I'm hoping everything will work :p. In the future "StdThread.h" can be removed (maybe when OS X ships with gcc 4.4 and vs2015 is released :p).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6933 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -54,10 +54,9 @@ void AOSound::SoundLoop()
|
||||
}
|
||||
}
|
||||
|
||||
void *soundThread(void *args)
|
||||
void soundThread(AOSound *aosound)
|
||||
{
|
||||
((AOSound *)args)->SoundLoop();
|
||||
return NULL;
|
||||
aosound->SoundLoop();
|
||||
}
|
||||
|
||||
bool AOSound::Start()
|
||||
@ -66,7 +65,7 @@ bool AOSound::Start()
|
||||
|
||||
soundSyncEvent.Init();
|
||||
|
||||
thread = new Common::Thread(soundThread, (void *)this);
|
||||
thread = std::thread(soundThread, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -81,8 +80,7 @@ void AOSound::Stop()
|
||||
soundSyncEvent.Set();
|
||||
|
||||
soundCriticalSection.Enter();
|
||||
delete thread;
|
||||
thread = NULL;
|
||||
thread.join();
|
||||
|
||||
if (device)
|
||||
ao_close(device);
|
||||
|
Reference in New Issue
Block a user