Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge SPDL_HOLD_GIL and NB_FREE_THREADED macro (#223)" #241

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ option(SPDL_USE_NPPI "Enable NVIDIA 2D Image And Signal Performance Primitives s
option(SPDL_LINK_STATIC_NVJPEG "Link nvJPEG and NPPI statically." OFF)

option(SPDL_DEBUG_REFCOUNT "Enable debug print for reference counting of AVFrame objects." OFF)
option(SPDL_HOLD_GIL "Hold GIL in IO functions." OFF)
option(SPDL_BUILD_STUB "Build Python binding stub file" OFF)
option(SPDL_BUILD_PYTHON_BINDING "Build Python binding" ON)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def _b(var):
f"-DSPDL_USE_FFMPEG_VERSION={_SPDL_USE_FFMPEG_VERSION}",
f"-DSPDL_DEBUG_REFCOUNT={_b(_env('SPDL_DEBUG_REFCOUNT'))}",
f"-DSPDL_BUILD_STUB={_b(_SPDL_BUILD_STUB)}",
f"-DSPDL_HOLD_GIL={_b(_env('SPDL_HOLD_GIL', False))}",
###################################################################
f"-DPython_INCLUDE_DIR={sysconfig.get_paths()['include']}",
"-GNinja",
Expand Down
3 changes: 3 additions & 0 deletions src/binding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function(add_spdl_extension ffmpeg_version)
if (SPDL_USE_NVCODEC)
list(APPEND defs SPDL_USE_NVCODEC)
endif ()
if (SPDL_HOLD_GIL)
list(APPEND defs SPDL_HOLD_GIL)
endif ()

nanobind_add_module(${name} ${src})
target_compile_definitions(${name} PRIVATE "${defs}")
Expand Down
4 changes: 2 additions & 2 deletions src/binding/core/gil.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include <nanobind/nanobind.h>

#ifdef NB_FREE_THREADED
#define RELEASE_GIL() // do not release GIL in FT Python
#ifdef SPDL_HOLD_GIL
#define RELEASE_GIL()
#else
#define RELEASE_GIL() nb::gil_scoped_release __g;
#endif
Loading