summaryrefslogtreecommitdiffstats
path: root/osdep/threads.c
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2023-10-15 19:47:33 +0200
committersfan5 <sfan5@live.de>2023-10-20 21:33:46 +0200
commit218115915839cde153e7c4e2110e6324e7d633c6 (patch)
treef27ee8de54be97f07742b29467cf1b212d2976fb /osdep/threads.c
parentd05ef7fdc4eb527a940a1ec7449e8c5bf60f5862 (diff)
downloadmpv-218115915839cde153e7c4e2110e6324e7d633c6.tar.bz2
mpv-218115915839cde153e7c4e2110e6324e7d633c6.tar.xz
threads: add support for pthread_mutex_trylock
Diffstat (limited to 'osdep/threads.c')
-rw-r--r--osdep/threads.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/osdep/threads.c b/osdep/threads.c
index 17642a3f89..0b96216cc7 100644
--- a/osdep/threads.c
+++ b/osdep/threads.c
@@ -79,3 +79,13 @@ int mp_ptwrap_mutex_init(const char *file, int line, pthread_mutex_t *m,
pthread_mutexattr_destroy(&m_attr);
return res;
}
+
+int mp_ptwrap_mutex_trylock(const char *file, int line, pthread_mutex_t *m)
+{
+ int res = (pthread_mutex_trylock)(m);
+
+ if (res != EBUSY)
+ mp_ptwrap_check(file, line, res);
+
+ return res;
+}