mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
Kernel: Clean up sys$futex and add support for cross-process futexes
This commit is contained in:
parent
55c7496200
commit
9db10887a1
9 changed files with 164 additions and 70 deletions
|
@ -83,7 +83,7 @@ int sem_post(sem_t* sem)
|
|||
// Check if another sem_post() call has handled it already.
|
||||
if (!(value & POST_WAKES)) [[likely]]
|
||||
return 0;
|
||||
int rc = futex_wake(&sem->value, 1);
|
||||
int rc = futex_wake(&sem->value, 1, false);
|
||||
VERIFY(rc >= 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ int sem_timedwait(sem_t* sem, const struct timespec* abstime)
|
|||
// Re-evaluate.
|
||||
continue;
|
||||
if (going_to_wake) [[unlikely]] {
|
||||
int rc = futex_wake(&sem->value, count - 1);
|
||||
int rc = futex_wake(&sem->value, count - 1, false);
|
||||
VERIFY(rc >= 0);
|
||||
}
|
||||
return 0;
|
||||
|
@ -162,7 +162,7 @@ int sem_timedwait(sem_t* sem, const struct timespec* abstime)
|
|||
}
|
||||
// At this point, we're committed to sleeping.
|
||||
responsible_for_waking = true;
|
||||
futex_wait(&sem->value, value, abstime, CLOCK_REALTIME);
|
||||
futex_wait(&sem->value, value, abstime, CLOCK_REALTIME, false);
|
||||
// This is the state we will probably see upon being waked:
|
||||
value = 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue