On Monday, 15 February 2021 16:51:06 GMT Patrick Wigmore wrote:
> mp3_player_start() contains a while loop, and it looks like that is
> not supposed to terminate until playlist_index == 0.
> 
> If your interrupt handler calls restartmp3(), and restartmp3() calls
> mp3_player_start(), then the interrupt handler will not terminate
> until playlist_index == 0 and both functions return. So, I think that
> might be the problem.
> 
> I don't think you've posted enough code to know for sure, but if this
> is what's going on, then I think I would try having the interrupt
> handler run mp3_player_start() in a new thread. That way, the
> interrupt handler should terminate as soon as it has set the thread
> going, leaving mp3_player_start() to carry on on its own.
> 
> e.g.
> 
> threading.Thread(target=mp3_player_start).start()

Patrick,

Thanks.  I was beginning to realise (dimly) that it was something like this 
and have been trying to ensure that all functions exited cleanly.

Ideally, I think that rather than having my program start the MP3 Player 
during startup it needs to always be started from an interrupt and that's what 
I was looking at.  That way the program will sit in the almost infinitely long 
delay that was always the intention, except when an interrupt is being 
serviced.

However, I can see that this isn't the whole story and I need to look into 
your suggestion in a bit more detail.  I won't have time to do that this 
evening, so I'll have another go first thing in the morning.

Thanks again.

-- 



                Terry Coles



-- 
  Next meeting: Online, Jitsi, Tuesday, 2021-03-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to