mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Added potential fix for MacOSX thread problem.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user