mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
Kernel: Some futex improvements
This adds support for FUTEX_WAKE_OP, FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET, FUTEX_REQUEUE, and FUTEX_CMP_REQUEUE, as well well as global and private futex and absolute/relative timeouts against the appropriate clock. This also changes the implementation so that kernel resources are only used when a thread is blocked on a futex. Global futexes are implemented as offsets in VMObjects, so that different processes can share a futex against the same VMObject despite potentially being mapped at different virtual addresses.
This commit is contained in:
parent
7581b64705
commit
1d621ab172
23 changed files with 928 additions and 63 deletions
|
@ -65,7 +65,7 @@ int pthread_once(pthread_once_t* self, void (*callback)(void))
|
|||
// anyone.
|
||||
break;
|
||||
case State::PERFORMING_WITH_WAITERS:
|
||||
futex(self, FUTEX_WAKE, INT_MAX, nullptr);
|
||||
futex(self, FUTEX_WAKE, INT_MAX, nullptr, nullptr, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ int pthread_once(pthread_once_t* self, void (*callback)(void))
|
|||
[[fallthrough]];
|
||||
case State::PERFORMING_WITH_WAITERS:
|
||||
// Let's wait for it.
|
||||
futex(self, FUTEX_WAIT, state2, nullptr);
|
||||
futex(self, FUTEX_WAIT, state2, nullptr, nullptr, 0);
|
||||
// We have been woken up, but that might have been due to a signal
|
||||
// or something, so we have to reevaluate. We need acquire ordering
|
||||
// here for the same reason as above. Hopefully we'll just see
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue