Skip to content

Add lock to timer#49

Merged
ladd merged 1 commit intomainfrom
lvt-lock-timer
Nov 13, 2025
Merged

Add lock to timer#49
ladd merged 1 commit intomainfrom
lvt-lock-timer

Conversation

@ladd
Copy link

@ladd ladd commented Nov 13, 2025

Sorry for the churn -- the DispatchSource timer turns out to be more brittle than I thought.

Adding a lock to avoid EXC_BREAKPOINT when racing the suspend/resume paths.

@bachand

lock.withLock {
if !suspended {
// Must match calls between suspend/resume
flushTimer.suspend()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to lock in deinit to protect the flush timer, or are we only trying to protect the suspension state?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just the suspension state.

@ladd ladd merged commit 94e1709 into main Nov 13, 2025
4 checks passed
@ladd ladd deleted the lvt-lock-timer branch November 13, 2025 21:31
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.

2 participants