Skip to content

fix scalar fn race#375

Merged
jraymakers merged 1 commit intomainfrom
jray/fix-scalar-fn-race
Mar 22, 2026
Merged

fix scalar fn race#375
jraymakers merged 1 commit intomainfrom
jray/fix-scalar-fn-race

Conversation

@jraymakers
Copy link
Copy Markdown
Collaborator

@jraymakers jraymakers commented Mar 22, 2026

Uses of scalar functions would sometimes (rarely) result in memory corruption. Investigation revealed that this was due to calling notify_one from the callback after releasing the mutex. The main function deletes the cv and mutex when it wakes up, and this could happen before the notify_one call returned. To fix this, notify_one is now called while the lock is held. See these notes on notify_one for some details one how this works.

@jraymakers jraymakers merged commit 00f16ab into main Mar 22, 2026
6 checks passed
@jraymakers jraymakers deleted the jray/fix-scalar-fn-race branch March 22, 2026 19:16
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