Skip to content

was: make notification cancellation atomic - #457

Merged
stintel merged 1 commit into
mainfrom
fix/notify_cancel_race
Jul 21, 2026
Merged

was: make notification cancellation atomic#457
stintel merged 1 commit into
mainfrom
fix/notify_cancel_race

Conversation

@stintel

@stintel stintel commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Notification callbacks set notify_data.cancel while notify_task reads it without holding notify_mutex. The plain bool access is therefore a data race even though updates of notify_active itself are serialized.

Make only the cancel flag C11 atomic. Existing assignments and reads become sequentially consistent atomic operations, retaining the current control flow and cancellation behavior while removing undefined behavior.

Notification callbacks set notify_data.cancel while notify_task reads
it without holding notify_mutex. The plain bool access is therefore a
data race even though updates of notify_active itself are serialized.

Make only the cancel flag C11 atomic. Existing assignments and reads
become sequentially consistent atomic operations, retaining the current
control flow and cancellation behavior while removing undefined
behavior.

Reported-by: GPT-5.6-sol
@stintel
stintel merged commit 9e64b43 into main Jul 21, 2026
9 checks passed
@stintel
stintel deleted the fix/notify_cancel_race branch July 21, 2026 20:54
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