]> git.tuebingen.mpg.de Git - paraslash.git/commit
ao_write: Avoid pthread_join().
authorAndre Noll <maan@systemlinux.org>
Mon, 3 Feb 2014 19:30:11 +0000 (20:30 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 6 Apr 2014 06:53:26 +0000 (08:53 +0200)
commitd2c65fd068a5c2e7cde52bd06e1eadc7e7e37364
treec43b3fa65cb7fa48cc69ed81a78a348fcb5aac18
parent41cb0352145fb8f95b6c14e69beb96efdd0e9b33
ao_write: Avoid pthread_join().

The call to pthread_join() may block for hundreds of milliseconds,
depending of the amount of buffered data. This is not acceptable in
a post_select hook. Among other problems this leads to an incorrect time
display and fake "time jump" warnings.

This patch drops the call to pthread_join() and makes ->post_select()
return non-negative until the play thread has terminated. In order to
have a way to tell if the thread is still running we let the thread
(i.e. aow_play()) remove its own buffer tree node on exit instead
of doing this in ->post_select() after pthread_join(). Hence if
->thread_btrn is NULL, we know the thread has terminated. It would
be easier to use pthread_tryjoin_np() but this would not be portable,
as this function is a non-standard GNU extension.
ao_write.c
error.h