diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2012-04-20 22:05:22 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2012-04-20 22:05:22 +0200 |
commit | bbed23df60c4bfc067b4f7c03574cfe11cc8bb60 (patch) | |
tree | 6e5bb509bc46db4039675092ab45b7375f852caa | |
parent | 35763dea799c96361e288a10eab0fbd16c36e880 (diff) | |
download | pianobar-windows-bbed23df60c4bfc067b4f7c03574cfe11cc8bb60.tar.gz pianobar-windows-bbed23df60c4bfc067b4f7c03574cfe11cc8bb60.tar.bz2 pianobar-windows-bbed23df60c4bfc067b4f7c03574cfe11cc8bb60.zip |
Don’t unlock mutex that is not locked
Strict pthread implementations (like OpenBSD’s rthreads with
PTHREAD_MUTEX_TYPE_STRICT_NP set) don’t allow unlocking a mutex that is
not locked, resulting in abort() being called. Always aquiring the lock
before unlocking it while skipping to the next song fixes this. Thanks
to David Coppa.
-rw-r--r-- | src/ui_act.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ui_act.c b/src/ui_act.c index 2cc559f..76b9411 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2011 +Copyright (c) 2008-2012 Lars-Dominik Braun <lars@6xq.net> Permission is hereby granted, free of charge, to any person obtaining a copy @@ -50,6 +50,8 @@ static inline void BarUiDoSkipSong (struct audioPlayer *player) { assert (player != NULL); player->doQuit = 1; + /* unlocking an unlocked mutex is forbidden by some implementations */ + pthread_mutex_trylock (&player->pauseMutex); pthread_mutex_unlock (&player->pauseMutex); } |