[PR] compat/w32pthreads: add pthread_mutex_trylock (PR #24018)

Lynne via ffmpeg-devel <[email protected]> Wed, 05 Aug 2026 13:27:41 -0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178593646260.59.10081474169630622036@29965ddac10e>
PR #24018 opened by Lynne
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24018
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24018.patch


>From 4299db2d7d917026539be6646e5ce89f76a76c24 Mon Sep 17 00:00:00 2001
From: Lynne <[email protected]>
Date: Wed, 5 Aug 2026 22:24:05 +0900
Subject: [PATCH] compat/w32pthreads: add pthread_mutex_trylock

---
 compat/w32pthreads.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index f689d04d51..886d8fa33b 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -146,6 +146,11 @@ static inline int pthread_mutex_unlock(pthread_mutex_t *m)
     return 0;
 }
 
+static inline int pthread_mutex_trylock(pthread_mutex_t *m)
+{
+    return !TryAcquireSRWLockExclusive(m);
+}
+
 typedef INIT_ONCE pthread_once_t;
 #define PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]