Skip to content

Fix race in event wait setup#312

Open
Aglcr7 wants to merge 1 commit into
jaseg:mainfrom
Aglcr7:codex/fix-python-mpv-61-wait-event-race-20260528210048
Open

Fix race in event wait setup#312
Aglcr7 wants to merge 1 commit into
jaseg:mainfrom
Aglcr7:codex/fix-python-mpv-61-wait-event-race-20260528210048

Conversation

@Aglcr7
Copy link
Copy Markdown

@Aglcr7 Aglcr7 commented May 29, 2026

Closes #61

Summary

  • Marks the wait Future as running before registering event callbacks in prepare_and_wait_for_event().
  • Prevents an immediately delivered event from completing the future before set_running_or_notify_cancel() is called.
  • Adds a regression test that simulates an event firing during registration without starting a real libmpv instance.

Fixes #61.

Verification

  • python -m py_compile mpv.py tests/test_mpv.py
  • git diff --check

Notes

  • I could not run the focused unittest locally because this Windows environment does not have mpv-1.dll, mpv-2.dll, or libmpv-2.dll available for import mpv.

…gistering callbacks so an event delivered immediately during registration cannot complete the Future before set_running_or_notify_cancel() runs.\n\nFixes jaseg#61.
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.

Stuck in threading on macOS

1 participant