hawkw / mycelium

🍄 an alleged 'operating system'
https://mycelium.elizas.website
MIT License
537 stars 19 forks source link

maitake-sync: add fair spinlock #471

Open hawkw opened 8 months ago

hawkw commented 8 months ago

maitake-sync's async Mutex and RwLock are guaranteed to be fair, because they use FIFO wait queues. however, the spin module's blocking locks are not fair. it would be nice to have a fair FIFO spinlock in maitake-sync, in addition to our current unfair mutex. we could implement a fair spinlock using a ticket lock.