Skip to content

Conversation

@divergentdave
Copy link
Contributor

This PR adds a shim for libc::nanosleep, (available under -Zmiri-disable-isolation only) which backs thread::sleep on Linux and macOS. I started off by extracting the timespec parsing from the pthread_cond_timedwait shim into a helper method, and adding checks for invalid values. The second commit adds the new shim and a small test. The shim blocks the current thread, and registers a timeout callback to unblock the thread again, using the same method as pthread_cond_timedwait does.

@divergentdave
Copy link
Contributor Author

OK, made the changes. I like the Option<> recommendation, that code is almost monadic now.

@RalfJung
Copy link
Member

RalfJung commented Sep 8, 2020

Awesome, thanks a lot for the PR!
@bors r+

@bors
Copy link
Contributor

bors commented Sep 8, 2020

📌 Commit b06f0d1 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Sep 8, 2020

⌛ Testing commit b06f0d1 with merge 604a674...

@bors
Copy link
Contributor

bors commented Sep 8, 2020

☀️ Test successful - checks-travis, status-appveyor
Approved by: RalfJung
Pushing 604a674 to master...

@bors bors merged commit 604a674 into rust-lang:master Sep 8, 2020
@divergentdave divergentdave deleted the nanosleep branch October 26, 2020 21:48
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.

3 participants