Antoine Jacoutot:
> Would something like this work?
> +--- ogg123/ogg123.c.orig Mon May 14 09:47:08 2012
> ++++ ogg123/ogg123.c Mon May 14 09:47:01 2012
> +@@ -743,7 +743,7 @@ void play (char *source_string)
> +
> + format->cleanup(decoder);
> + transport->close(source);
> +- status_reset_output_lock(); /* In case we were killed mid-output */
> ++ pthread_cleanup_push(status_reset_output_lock, NULL); /* In case we were
> killed mid-output */
> +
> + status_message(1, _("Done."));
No, this doesn't make sense. If the output_lock mutex is held, it
needs to be released before status_message() is called--otherwise
that function will block.
I wonder if there even *is* a scenario where we can end up here
with output_lock still held. All references to that mutex are like
this:
pthread_cleanup_push(unlock_output_lock, NULL);
pthread_mutex_lock(&output_lock);
/* ... do something ... */
pthread_mutex_unlock(&output_lock);
pthread_cleanup_pop(0);
Which makes me think that status_reset_output_lock() can simply be
omitted. Or is there a way for a thread to exit without the cleanup
routine ever being called?
--
Christian "naddy" Weisgerber [email protected]