You may have made a poor choice of hobby, then.Henk wrote:As long as there are no files involved fine. Don't like working with files or databases. But programming is not fun.

Moderator: Ras
You may have made a poor choice of hobby, then.Henk wrote:As long as there are no files involved fine. Don't like working with files or databases. But programming is not fun.
This requires a signal handler to catch SIGCHLD signals (the signal delivered when a child process terminates. In the signal handler you have to do a waitpid(-1, &status, WNOHANG) repeatedly until it returns a value <= 0 to indicate you have cleaned up all the zombie processes that are waiting around to report their termination status back to the parent (xboard).jdart wrote:I notice xboard seems to proliferate "aplay" processes, for example:
aplay -q /usr/local/share/games/xboard/sounds/gong.wav
I do sometimes kill the parent process (xboard) and it seems these other processes don't die.
--Jon
That should count as a bug in your 'aplay'. As far as XBoard is concerned, aplay is 'fire and forget'. No communication channel is set up between XBoard and the sound app, it just uses system("aplay -q ..."); and goes on. aplay is supposed to terminate once it is done playing the indicated sound. The .wav files are all of finite duration, so there is no way an aplay process should be able to stay alive.jdart wrote:I notice xboard seems to proliferate "aplay" processes, for example:
aplay -q /usr/local/share/games/xboard/sounds/gong.wav
I do sometimes kill the parent process (xboard) and it seems these other processes don't die.
Do you do a fork()/system() to run it? If so any child process goes into the "defunct" or "zombie" state when it terminates, until the parent executes something like a waited() to clean it up. Here's the basics of what you need to do:hgm wrote:That should count as a bug in your 'aplay'. As far as XBoard is concerned, aplay is 'fire and forget'. No communication channel is set up between XBoard and the sound app, it just uses system("aplay -q ..."); and goes on. aplay is supposed to terminate once it is done playing the indicated sound. The .wav files are all of finite duration, so there is no way an aplay process should be able to stay alive.jdart wrote:I notice xboard seems to proliferate "aplay" processes, for example:
aplay -q /usr/local/share/games/xboard/sounds/gong.wav
I do sometimes kill the parent process (xboard) and it seems these other processes don't die.
I don't think they are actually running. They are almost certainly in the "zombie/defunct" state (term depends on operating system, recent Linux kernels use <defunct>.jdart wrote:I don't know why it wouldn't terminate but it seems sometimes it doesn't.
I notice aplay apparently has a -d flag to set the duration, maybe that would help workaround this.
Or xboard could kill it.
--Jon