News for hackers. Stuff that matters.
Re:Proposed futex2 allows Linux to mimic the NT kernel for b... by gpderetta on Sunday May 02, 2021 @05:56AM (#27013788)
You wouldn't want to use an event loop to wait for a mutex as it doesn't really make much sense. It does make sense to use an event loop to wait for empty/non empty events (which on a normal queue you would implement with a cond var).

You have two options: you can use an eventfd to implement the queue full/empty event, or provide a generic notification interface (i.e. a callback). Any non event loop users wiuld simply have the callback signal a futex, but it allows for more complex use case: obviously you can wakeup the event loop from the callback, but you could resume a coroutine, send an async signal or whatever makes sense for the application.

There are no comments on this comment yet.