Fix hangs during pbzip2 compression.

pbzip2 sometimes hangs during compression because it doesn't lock when
calling pthread_cond_broadcast(..), so the thread holding the lock might
not get the message if it has already checked the condition but has not
called pthread_cond_wait(...) yet. To fix this, I've upgraded pbzip2 to
consistently lock before calling pthread_cond_* functions.

These hangs can be reproduced consistently if you add a 5 second sleep to
safe_cond_wait(...) before it calls pthread_cond_wait(...). With my fix,
the hangs no longer occur.

This bug is tracked upstream at https://bugs.launchpad.net/pbzip2/+bug/876686

I've also upgraded to pbzip2 1.1.5.

BUG=chromium-os:21726
TEST=Test compressing any file (e.g. an empty file) with the 5 second sleep.
     Before the change, it hangs every time. After the change, it doesn't
     hang. Also run trybot run.

Reviewed-on: http://gerrit.chromium.org/gerrit/10164
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
(cherry picked from commit 5b47f7a0729e0764981a3d4dd7ae95d09fd373b0)

Change-Id: I7e6a22aa1146aa37ef5c9c899a9f4da788096add
Reviewed-on: http://gerrit.chromium.org/gerrit/10274
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
3 files changed