ft_utils

ft_utils API Documentation

Modules

The ft_utils API is organized into several modules, each providing a specific set of functionalities.

concurrent

The concurrent module provides a set of foundational structures to implement scalable and efficient Free Threaded code. Using these structures can help avoid bottlenecks and enhance thread-consistency in FTPython code.

synchronization

The synchronization module provides specialized lock types that work in GIL-based Python and offer significant benefits for Free Threaded programming. These locks can help improve the performance and reliability of concurrent code.

local

The local module provides helper classes to move certain forms of processing from being cross-thread to being local to a thread. These classes are necessary to avoid key bottlenecks that can occur due to cache contention, critical sections, and reference counting in Free Threaded Python.

Native Code

The ft_compat header provides backward compatibility for native code.

For developers writing native code (C, C++, Rust, etc.) that interacts with the Python C API, ft_compat.h provides a backwards compatibility layer for Free Threading-related APIs. This allows you to write code that takes advantage of Free Threading features, such as atomic operations and critical sections, while still maintaining support for older versions of Python. By using ft_compat.h, you can ensure that your native code is compatible with multiple versions of Python, reducing maintenance and testing efforts.