adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Re: SDL_mixer


From: Alexandre Courbot
Subject: Re: [Adonthell-devel] Re: SDL_mixer
Date: 06 Jan 2002 14:36:47 +0100

> I also have a new theory: the song-change script is executed from the
> audio thread. So unlike any other script, it might interrupt the python
> interpreter while another script runs, mess up the internals and cause a
> crash. (either instantly, or a little later).
> 
> On a fast box, like your's, the chance that song change and execution of
> another python script happen at the same time is rather small. But on my
> old P200 it is much more likely, which might explain why I face more
> problems.

Riiiiiight! Python isn't thread safe by default. I haven't realised the
audio change was done in the audio thread - but that's a very plausible
explanation, as before we always used Python in the same thread and it
was just fine!

> Or, perhaps easier: just set a flag in the audio thread and periodically
> check that from the main thread and call the songchange script when
> necessary.

Yes. The only way to be sure it's safe is to make all the Python stuff
being done in the same thread. If it makes problems, I think the Python
docs mention about thread safety, you might want to have a look.

Actually, this is the bug I had 2 or 3 times. I thought it would come
from the characters schedules, but now I'm pretty sure it's the audio
thread thing. Well done, Kai! :)

Alex.

-- 
http://www.gnurou.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]