Added potential fix for MacOSX thread problem.

This commit is contained in:
rude
2009-08-27 00:21:29 +02:00
parent 0aae22d523
commit 37745bf745
2 changed files with 11 additions and 2 deletions
+6 -2
View File
@@ -27,6 +27,7 @@ namespace audio
namespace openal
{
Audio::Audio()
: finish(false)
{
// Passing zero for default device.
device = alcOpenDevice(0);
@@ -52,7 +53,10 @@ namespace openal
Audio::~Audio()
{
SDL_KillThread(thread);
finish = true;
int status;
SDL_WaitThread(thread, &status);
pool->stop();
@@ -67,7 +71,7 @@ namespace openal
{
Audio * instance = (Audio*)d;
while(true)
while(!instance->finish)
{
instance->pool->update();
SDL_Delay(10);
+5
View File
@@ -65,6 +65,11 @@ namespace openal
// The Pool.
Pool * pool;
// Set this to true when the thread should finish.
// Main thread will write to this value, and Audio::run
// will read from it.
bool finish;
static int run(void * unused);
public: