I'm having problems with quitting a Pygame application (6502 based computer emulator).
The part regarding exit looks like this:
while True:
do_something_200_times()
for event in pygame.event.get()
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
I'm also using pygame.mixer to play sounds as they appear, but I'm not sure that's related. I'm also using pygame.time.set_timer to update screen in regular intervals and play sound if buffer has filled enough. Is it possible the event queue overfills? How would I determine if this is the case?
It simply freezes in 40-50% cases, and attaching strace -p to the python interpreter gives:
Process 21326 attached
futex(0x7f5a32f839d0, FUTEX_WAIT, 21329, NULL
Also, I'm getting occasional pulseaudio related crashes, is this combination known to be buggy?
Any ideas and suggestions are more than welcome! Thanks!
EDIT: it freezes when I click the window's close button (x)
sys.exit()only raises an exeption. If anything catches it (pygame or perhaps pygame.mixer) it won't actually exit. Try callingbreakorreturninstead to see if that's the problem. \$\endgroup\$