Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
21 lines
354 B
Python
21 lines
354 B
Python
from __future__ import annotations
|
|
|
|
import threading
|
|
|
|
|
|
_lock = threading.Lock()
|
|
_listen_only_mode = False
|
|
|
|
|
|
def set_listen_only(enabled: bool) -> bool:
|
|
global _listen_only_mode
|
|
with _lock:
|
|
_listen_only_mode = bool(enabled)
|
|
return _listen_only_mode
|
|
|
|
|
|
def is_listen_only() -> bool:
|
|
with _lock:
|
|
return _listen_only_mode
|
|
|