[vlc-commits] android: use the new mutex checks
Rémi Denis-Courmont
git at videolan.org
Sun Oct 21 13:01:26 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 20 22:36:49 2018 +0300| [9575e9476cdc17e60fcbf40af1b90c3929c63e50] | committer: Rémi Denis-Courmont
android: use the new mutex checks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9575e9476cdc17e60fcbf40af1b90c3929c63e50
---
src/android/thread.c | 13 +++++--------
src/libvlc.h | 4 ++--
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/android/thread.c b/src/android/thread.c
index ce70b478b7..0cce89e749 100644
--- a/src/android/thread.c
+++ b/src/android/thread.c
@@ -113,25 +113,21 @@ void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
VLC_THREAD_ASSERT ("destroying mutex");
}
-#ifndef NDEBUG
-void vlc_assert_locked (vlc_mutex_t *p_mutex)
-{
- assert (pthread_mutex_lock (p_mutex) == EDEADLK);
-}
-#endif
-
void vlc_mutex_lock (vlc_mutex_t *p_mutex)
{
int val = pthread_mutex_lock( p_mutex );
VLC_THREAD_ASSERT ("locking mutex");
+ vlc_mutex_mark(p_mutex);
}
int vlc_mutex_trylock (vlc_mutex_t *p_mutex)
{
int val = pthread_mutex_trylock( p_mutex );
- if (val != EBUSY)
+ if (val != EBUSY) {
VLC_THREAD_ASSERT ("locking mutex");
+ vlc_mutex_mark(p_mutex);
+ }
return val;
}
@@ -139,6 +135,7 @@ void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
{
int val = pthread_mutex_unlock( p_mutex );
VLC_THREAD_ASSERT ("unlocking mutex");
+ vlc_mutex_unmark(p_mutex);
}
void vlc_once(vlc_once_t *once, void (*cb)(void))
diff --git a/src/libvlc.h b/src/libvlc.h
index dff18d6285..cbe598ad6f 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -83,9 +83,9 @@ bool vlc_mutex_marked(const vlc_mutex_t *);
*/
#define vlc_mutex_assert(m) assert(vlc_mutex_marked(m))
-#if (defined (LIBVLC_USE_PTHREAD))
+#if (defined (LIBVLC_USE_PTHREAD) || defined (__ANDROID__))
#define vlc_assert_locked(m) vlc_mutex_assert(m)
-#elif (defined(__ANDROID__) || defined (__APPLE__)) && !defined (NDEBUG)
+#elif defined (__APPLE__) && !defined (NDEBUG)
void vlc_assert_locked (vlc_mutex_t *);
#else
# define vlc_assert_locked( m ) (void)m
More information about the vlc-commits
mailing list