Skip to content

πŸš€ ThreadFactory 1.2.4 β€” Smarter Collections, Stronger Control

Latest
Compare
Choose a tag to compare
@Synaptic724 Synaptic724 released this 03 May 08:20
· 3 commits to production since this release

High-performance thread-safe collections, lifecycle-aware Work objects, a full benchmarking suite, and the foundation of modular concurrency for Python 3.13+ (Free Threading).
While active development on ThreadFactory is paused temporarily, the team is now building Melder, a powerful DI and composition framework designed to work seamlessly with these primitives.


πŸ†• [1.2.4] - 2025-05-02

πŸš€ Classes Added

ConcurrentSet

  • A fully thread-safe set implementation designed for high read and concurrent write workloads.
  • Supports full set algebra: union, intersection, difference, symmetric_difference, with both standard and in-place forms.
  • Includes:
    • freeze() mode to make the structure lock-free for reads.
    • batch_update() for atomic composite operations.
    • Functional access (map, filter, reduce).
  • Integrates cleanly with Python idioms:
    • with ConcurrentSet(...) as s: enables atomic scoped access.
    • Implements IDispose, supporting proper lifecycle cleanup.

βž• New Features

πŸ”„ Set Algebra + Operators

  • Standard operations: |, &, -, ^
  • In-place versions: |=, &=, -=, ^=
  • Method equivalents: union(), intersection(), etc.

🧠 Functional Utilities

  • Built-in map(func), filter(func), and reduce(func) on the set β€” thread-safe and iterable-aware.

🧊 Freeze Mode

  • New freeze() method added to:
    • ConcurrentSet
    • ConcurrentList
    • ConcurrentDict
  • When frozen:
    • All mutations are blocked.
    • Reads (iteration, contains, length) become lock-free, improving performance.
    • Unfreeze manually or via internal mechanisms.

🧡 Lock-Aware Reads

  • Smart internal handling avoids unnecessary locking:
    • __iter__, __contains__, __len__, and copies are optimized based on freeze state.

πŸ”’ Atomic Batch Operations

  • batch_update(func) ensures thread-safe bulk changes under a single lock pass.

πŸ›  Fixes

  • ConcurrentQueue and ConcurrentStack:

    • peek() now uses try/finally to guarantee lock release even when exceptions are raised.
  • Clarified locking strategy and lifecycle handling across concurrent_core classes via enhanced docstrings.


πŸ”„ Changes

  • License upgraded from MIT to Apache 2.0

    • Enforces better attribution.
    • Improves corporate compliance and future integration safety.
  • NOTICE File

    • Now includes formal third-party acknowledgments.
  • Disposal Standardization

    • All disposable types implement a common IDispose interface with internal .disposed flags and dispose() methods.

🧭 Project Status

Development on ThreadFactory is not abandoned β€” it’s currently paused as the team shifts focus to a companion framework:

Melder β€” A dependency injection and object composition system that integrates deeply with ThreadFactory.

Melder will allow you to:

  • Compose concurrent flows using declarative bindings.
  • Control lifecycles with Work + Scope-aware systems.
  • Scale from functions to full orchestrated pipelines.

ThreadFactory will resume updates once Melder stabilizes, with both designed to work together in the long term.


πŸ“¦ Install or Upgrade

pip install --upgrade threadfactory