If mpg123 is what's actually playing the music, then that's what you need
to stop, not the thread that's shelling out to it.

You might look at Process.spawn, which can be used to obtain mpg123's PID.
You can then use Process.kill to send it signals, rather than shelling out
to killall.

On Wed, Jun 13, 2012 at 11:35 AM, Mike Worth <lists / ruby-forum.com> wrote:

> I'm improving a music playing script I've written; I want to add a
> feature that automatically pauses the music if I wander off by detecting
> the bluetooth on my phone. The main thread deals with the UI while there
> is a thread running to play whatever is on the playlist and another
> thread to deal with the auto-pausing.
>
> At the moment I'm pausing the music by using "system('killall -STOP
> mpg321')", this is quite crude and can get confused by other instances
> of mpg321. While Thread.stop will pause a thread from within, I cannot
> work out a way to pause a thread from another thread. Is this possible,
> or is there a good reason why this has been omitted?
>
> Thanks,
> Mike
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


-- 
Tony Arcieri