Jaroslav,
In recent versions of aplay, if I try to either run them in the background, or run them in the foreground, then ^Z and bg them, they hang indefinitely:
aplay foo.wav & # doesn't play anything
aplay foo.wav ... ^Z bg [1]+ Stopped aplay foo.wav bg [1]+ Stopped aplay foo.wav
At least, this is true under ChromeOS on ARM with kernel 2.6.38 and ALSA 1.0.24.2, or an Ubuntu Natty rootstock on ARM with the same ChromeOS kernel.
This was introduced by alsa-utils commit: 3bd65336222a4d00cefc4db5e74a7a96c07ab567 aplay/arecord: Added hardware pause support (press SPACE or Enter)
What happens is that the call to tcsetattr causes the process to receive signal TTOU and be stopped. Running under strace yields an infinite loop with ioctl(TCSETS) returning -ERESTARTSYS, and being retried.
I believe this is related to http://lkml.org/lkml/2008/6/2/157.
I'm not exactly sure how to solve this though. Another post in that thread implied that adding a signal handler for TTOU and then adjusting the tcsetattr settings might help, but I'm not convinced about that, since I believe the -ERESTARTSYS handling loop is inside the call to tcsetattr, and hence tcsetattr's parameters can't be changed.
Does anyone have any ideas? Thanks.