[PATCH] ogg123, output via esd, hang after SIGINT
The following problem occurs under Cygwin with ogg123 from vorbis-tools 1.1.1:
When ogg123 is running playback via esd, pressing Ctrl-C will result in a hang in most cases. I tracked it down to buffer.c, submit_data_chunk(). The hang reliably occurs when waiting for the "No room for data in buffer. Waiting." conditional wait. I have applied the following patch to the Cygwin version, which seem to solve the problem. I'm just not sure it's really the correct way to solve the problem. I'd appreciate any feedback.
--- ogg123/buffer.c.ORIG 2005-06-03 12:15:09.000000000 +0200
+++ ogg123/buffer.c 2005-09-23 15:53:26.150989900 +0200
@@ -308,6 +308,11 @@ void submit_data_chunk (buf_t *buf, char
}
else {
+ if (buf->cancel_flag || sig_request.cancel)
+ {
+ UNLOCK_MUTEX(buf->mutex);
+ break;
+ }
/* No room for more data, wait until there is */
DEBUG("No room for data in buffer. Waiting.");
COND_WAIT(buf->write_cond, buf->mutex);
Greetings, Corinna