1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

Kernel+Userland: Remove global futexes

We only ever use private futexes, so it doesn't make sense to carry
around all the complexity required for global (cross-process) futexes.
This commit is contained in:
Andreas Kling 2021-08-16 23:29:25 +02:00
parent 7979b5a8bb
commit 4226b662cd
8 changed files with 48 additions and 188 deletions

View file

@ -14,11 +14,11 @@
namespace Kernel {
class FutexQueue : public Thread::BlockCondition
, public RefCounted<FutexQueue>
, public Memory::VMObjectDeletedHandler {
class FutexQueue
: public RefCounted<FutexQueue>
, public Thread::BlockCondition {
public:
FutexQueue(FlatPtr user_address_or_offset, Memory::VMObject* vmobject = nullptr);
FutexQueue();
virtual ~FutexQueue();
u32 wake_n_requeue(u32, const Function<FutexQueue*()>&, u32, bool&, bool&);
@ -31,8 +31,6 @@ public:
return Thread::current()->block<Thread::FutexBlocker>(timeout, *this, forward<Args>(args)...);
}
virtual void vmobject_deleted(Memory::VMObject&) override;
bool queue_imminent_wait();
void did_remove();
bool try_remove();
@ -48,11 +46,6 @@ protected:
virtual bool should_add_blocker(Thread::Blocker& b, void* data) override;
private:
// For private futexes we just use the user space address.
// But for global futexes we use the offset into the VMObject
const FlatPtr m_user_address_or_offset;
WeakPtr<Memory::VMObject> m_vmobject;
const bool m_is_global;
size_t m_imminent_waits { 1 }; // We only create this object if we're going to be waiting, so start out with 1
bool m_was_removed { false };
};