std: pass hint to id-based parking functions

This commit is contained in:
joboet
2022-12-29 17:54:09 +01:00
parent a9e5c1a309
commit 3076f4ec30
3 changed files with 13 additions and 13 deletions

View File

@@ -56,7 +56,7 @@ impl Parker {
if state == PARKED {
// Loop to guard against spurious wakeups.
while state == PARKED {
park();
park(self.state.as_mut_ptr().addr());
state = self.state.load(Acquire);
}
@@ -72,7 +72,7 @@ impl Parker {
let state = self.state.fetch_sub(1, Acquire).wrapping_sub(1);
if state == PARKED {
park_timeout(dur);
park_timeout(dur, self.state.as_mut_ptr().addr());
// Swap to ensure that we observe all state changes with acquire
// ordering, even if the state has been changed after the timeout
// occured.
@@ -95,7 +95,7 @@ impl Parker {
// and terminated before this call is made. This call then returns an
// error or wakes up an unrelated thread. The platform API and
// environment does allow this, however.
unpark(tid);
unpark(tid, self.state.as_mut_ptr().addr());
}
}
}