From 6672f64b00f89ba0d37b04e95ca1feeafa9c33d4 Mon Sep 17 00:00:00 2001 From: billmccartney Date: Mon, 11 Sep 2023 16:52:21 -0400 Subject: [PATCH] Python Multithreading Support via GIL Enabled parallel Python support by disabling the GIL during ReadBarcodes. This allows multiple threads to decode different images at the same time in Python. --- wrappers/python/zxing.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wrappers/python/zxing.cpp b/wrappers/python/zxing.cpp index 3e35d74dba..ab615477f1 100644 --- a/wrappers/python/zxing.cpp +++ b/wrappers/python/zxing.cpp @@ -90,6 +90,8 @@ auto read_barcodes_impl(py::object _image, const BarcodeFormats& formats, bool t } const auto bytes = image.data(); + // Disables the GIL during zxing processing (restored automatically upon completion) + py::gil_scoped_release release; return ReadBarcodes({bytes, width, height, imgfmt, width * channels, channels}, hints); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy