Skip to content

Make the global console instance thread-safe #139

@hbisneto

Description

@hbisneto

Problem: The global console instance mutates internal state (_fore, _back, _styles) without locks, causing race conditions in concurrent writes

Why it matters: Multi-threaded CLIs can interleave styles, producing garbled output.

Proposed solution: Wrap state mutations in Console.call and style methods with a threading.Lock. Document that the global instance is now thread-safe; recommend per-instance Console for maximum performance.

Notes: Measure overhead; keep lock granularity minimal to avoid blocking single-threaded use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Console ModuleRelated to the "Console" module inside FileSystemPro

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions