# Copyright 2025–2026 European Union
# Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
# SPDX-License-Identifier: EUPL-1.2
"""
Utilities for parallel execution in MAFw.
.. versionadded:: v2.1.0
"""
from __future__ import annotations
import sys
[docs]
def is_free_threading() -> bool:
"""Check if Python is running in free-threading mode.
This function inspects the Python interpreter to determine whether it is running
in free-threading mode (also known as "nogil" or "free-threaded"), which disables
the Global Interpreter Lock (GIL).
:return: True if the interpreter is running in free-threading mode, False otherwise.
:rtype: bool
"""
is_gil_enabled = getattr(sys, '_is_gil_enabled', None)
if is_gil_enabled:
return not is_gil_enabled()
return False
__all__ = ['is_free_threading']
"""Public exports for the parallel utilities module."""