2

I'm using gloss to display something, while at the same time using forkOS $ system "mpg123 foo.mp3" >> return () to play some audio in the background. When I close the gloss window, the program exits, but the audio keeps playing. All resources show that this thread is supposed to die, what's going on? It doesn't die even when I use killThread to kill it explicitly.

Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124
  • 6
    The `system` function in general isn't interruptible. If you want killing the thread to terminate a spawned process, you can try catching the asynchronous `ThreadKilled` exception, call `terminateProcess`, then re-throw `ThreadKilled`. – John L May 06 '14 at 04:41
  • If I close the gloss window, the main process dies...so in that case `system` should die too, right? If I try this without gloss, the sound stops as expected. And if I kill the program with a ctrl-c on the command line, the sound stops too. – Vlad the Impala May 06 '14 at 17:58
  • "If I close the gloss window, the main process dies..." - have you verified that part - does the main process really die and not appear in the process list? – yairchu Jun 17 '15 at 10:34
  • @JohnL perhaps you should post your comment as an answer... – sclv Mar 12 '16 at 01:47

0 Answers0