Skip to content

dynamically size thread wake/sleep atomic notifier based on OS#166

Merged
tzcnt merged 3 commits intomainfrom
wake-sleep-os-optimized
Jan 6, 2026
Merged

dynamically size thread wake/sleep atomic notifier based on OS#166
tzcnt merged 3 commits intomainfrom
wake-sleep-os-optimized

Conversation

@tzcnt
Copy link
Copy Markdown
Owner

@tzcnt tzcnt commented Jan 6, 2026

Thanks to @solbjorn for letting me know about this. Per https://github.com/llvm/llvm-project/blob/main/libcxx/src/atomic.cpp, Windows only natively supports waiting on 8-byte variables. Linux only natively supports waiting on 4-byte variables. MacOS can support either.

If the wrong size is selected for the native OS API, the stdlib has to map the syscall through a separate map/table which adds latency.

This PR adds a type alias to select the correct size type.

@tzcnt tzcnt merged commit c5572e1 into main Jan 6, 2026
40 checks passed
@tzcnt tzcnt deleted the wake-sleep-os-optimized branch January 6, 2026 03:36
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