Skip to content

Conversation

ciricc
Copy link

@ciricc ciricc commented Sep 13, 2025

Problem

  • Context was params-centric and shared global state, leading to racy access and "concurrent map writes".

Solution

  • Refactor Context to be state-backed. Each Context now owns its own whisper_state for safe concurrent processing.
  • Introduce stateful and stateless Context flavors.
  • Add a high-level Parameters wrapper with a unified interface.

Key changes

  • Context isolation: per-instance whisper_state ownership.
  • Parameters abstraction: new top-level Parameters type.
  • Resource management: Close methods added and state validity checks after Close.
  • Type safety: wrap whisperCtx and whisperState pointers with lifecycle management.
  • Concurrency: fix sync.Map usage to be safe for parallel processing (since 59b3c47).
  • Tooling and tests: new benchmarks, test helpers, and expanded test coverage.
  • Build and module updates: Makefile and go.mod adjustments.

Compatibility

  • Backwards compatible: existing methods continue to work, with deprecation warnings where applicable.
  • Concurrent safe: removes "concurrent map writes" under parallel workloads.

Migration notes

  • Prefer the new Parameters wrapper and the new stateful/stateless context constructors.
  • Always call Close on Context and related resources when finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant