Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Kacper Michajłow via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: "Kacper Michajłow" <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avutil/vulkan_glslang: use AVMutex instead of pthread_mutex_t (PR #20762)
Date: Mon, 27 Oct 2025 10:55:30 -0000
Message-ID: <176156253061.81.3084728223768422293@7d278768979e> (raw)

PR #20762 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20762
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20762.patch


From 4deb8b3a7a3fc6131c8adb90ee9e32f7f2029575 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Mon, 27 Oct 2025 11:54:02 +0100
Subject: [PATCH] avutil/vulkan_glslang: use AVMutex instead of pthread_mutex_t
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
 libavutil/vulkan_glslang.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavutil/vulkan_glslang.c b/libavutil/vulkan_glslang.c
index 4cf54de854..20102c4fd7 100644
--- a/libavutil/vulkan_glslang.c
+++ b/libavutil/vulkan_glslang.c
@@ -16,16 +16,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <pthread.h>
-
 #include <glslang/build_info.h>
 #include <glslang/Include/glslang_c_interface.h>
 
 #include "vulkan_spirv.h"
 #include "libavutil/mem.h"
 #include "libavutil/avassert.h"
+#include "libavutil/thread.h"
 
-static pthread_mutex_t glslc_mutex = PTHREAD_MUTEX_INITIALIZER;
+static AVMutex glslc_mutex = AV_MUTEX_INITIALIZER;
 static int glslc_refcount = 0;
 
 static const glslang_resource_t glslc_resource_limits = {
@@ -277,10 +276,10 @@ static void glslc_uninit(FFVkSPIRVCompiler **ctx)
     if (!ctx || !*ctx)
         return;
 
-    pthread_mutex_lock(&glslc_mutex);
+    ff_mutex_lock(&glslc_mutex);
     if (glslc_refcount && (--glslc_refcount == 0))
         glslang_finalize_process();
-    pthread_mutex_unlock(&glslc_mutex);
+    ff_mutex_unlock(&glslc_mutex);
 
     av_freep(ctx);
 }
@@ -295,14 +294,14 @@ FFVkSPIRVCompiler *ff_vk_glslang_init(void)
     ret->free_shader    = glslc_shader_free;
     ret->uninit         = glslc_uninit;
 
-    pthread_mutex_lock(&glslc_mutex);
+    ff_mutex_lock(&glslc_mutex);
     if (!glslc_refcount++) {
         if (!glslang_initialize_process()) {
             av_freep(&ret);
             glslc_refcount--;
         }
     }
-    pthread_mutex_unlock(&glslc_mutex);
+    ff_mutex_unlock(&glslc_mutex);
 
     return ret;
 }
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-10-27 10:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176156253061.81.3084728223768422293@7d278768979e \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git