-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add futex syscalls #534
Add futex syscalls #534
Conversation
5c632a1
to
0d4780c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks a lot for your effort of migrating to the generic futex-based impls in std
. :)
bors try |
tryBuild succeeded: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excuse me for the late review. I was ill. Like @mkroening, I have the same question __sys_futex_wait.
The rest looks good for me! Thank you for your great support.
I've now clarified the timeout behaviour in the documentation. Also, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, @joboet! :)
bors r+
Use futex-based locks and thread parker on Hermit [Hermit now has futex syscalls](hermit-os/kernel#534), which means Hermit can share the well-tested and performant locks and thread parker used on Linux. Ping `@mkroening,` `@stlankes` r? `@m-ou-se`
Futexes greatly simplify the creation of synchronization primitives (see
std
's mutex). They are here implemented by using a hashmap, in which the handles to waiting threads are stored, keyed with the address of the futex they are waiting on.I prioritised readability over performance in this PR, faster implementations would use finer grained locking and would not need to allocate the queues. It should be performant enough for most purposes however.