Skip to content
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

Fix darwin ulock usage on macOS #9545

Merged
merged 3 commits into from
Aug 14, 2021
Merged

Fix darwin ulock usage on macOS #9545

merged 3 commits into from
Aug 14, 2021

Conversation

thomcc
Copy link
Contributor

@thomcc thomcc commented Aug 10, 2021

I was doing macOS ulock stuff, and was linked to Zig's DarwinFutex implementation by @kprotty. There were a few bugs I noticed:

  • __ulock_wait2 actually timeout as a u64, not u32 (this likely happens to work on at least x86_64 because of how the ABI works, but I can't say about others, and it's still UB either way).
  • Semantically, __ulock_wait2's timeout is in units of nanoseconds (this would just lead to waking up early which callers have to handle, but still).
  • EFAULT is not handled, but seems like it should be? At least almost all uses in system libraries / tests have it handled.

r? @kprotty

lib/std/Thread/Futex.zig Outdated Show resolved Hide resolved
lib/std/Thread/Futex.zig Outdated Show resolved Hide resolved
lib/std/Thread/Futex.zig Outdated Show resolved Hide resolved
@daurnimator daurnimator added the standard library This issue involves writing Zig code for the standard library. label Aug 11, 2021
@kprotty
Copy link
Member

kprotty commented Aug 14, 2021

Nice, any other changes you wish to make?

@thomcc
Copy link
Contributor Author

thomcc commented Aug 14, 2021

Nope, unless anybody has issues I think its good to land

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants