UPDATE: After taking my first steps into the larger world of fork/exec, I have something that works to the best that I can see. Read on for the new version. I'll probably eventually update it to not use ^C to get the next song so it's easier to stop the music. Thanks to RazorbladeBidet for gently pushing me to learn fork!

Regarding your updated code: Since the parent is doing a waitpid(), you do not want to set up a SIGCHLD handler. Use either one or the other (I'd suggest the waitpid). If the waitpid reaps the child, the SIGCHLD wait call will hang waiting for yet another child to be reaped.

I played around with that before, but used Tk which has "an event loop" to make this sort of thing easier. POE might be able to help you on the command-line versions. In the sources for mpg123, there is a README.remote file, which describes how to remotely control the player. You will have to play your songs thru the "piped-form of open", rather than backticks, so you can signal the player to skip to the next songs. With bacticks, killing the song, will kill the instance of the player, so you will be creating a new player for each song....kind of wasteful. The following example, has a "Pause" Button, but you can skip to the next song in a playlist by just LOADING it.

I'm a thread newbie on Windows/ActiveState and am just trying to figure out how to approach this whole mess, trying to glean knowledge from the masters.

Perlthrtut says fork is dangerous, use threads.

I think this is controversial. I also think this has been discussed before.

Can someone point me to where I can decide whether to do my multithreaded stuff using fork or thread, in a windows context?

UPDATE: Search on fork thread brings some good results, I know I know, but maybe *too* much. If someone could just tell me what to read based on personal experience I'd be grateful. Or maybe I'll just do a "survey of fork versus thread" like I did for the morass of perl html templating systems a few days ago...