libinput_suspend takes significant time to close devices
Summary
If libinput_suspend is called without having initially called EIOCREVOKE on the file descriptions, then libinput will have a ~40ms delay between each restricted_close call. This quickly adds up - my machine has 28 event devices after all. I have not yet dug into where libinput is hanging.
I discovered this during seatd development. While logind revokes file descriptors before signalling that at seat user should disable itself, seatd kept everything open until the seat user had sent the disable acknowledgement.
As a workaround, seatd now mimick logind's behavior until the root cause of this delay has been identified.
Steps to reproduce
On a machine with a significant number of event devices attached to seat0, run the following example code as user with sufficient privileges to open evdev devices: test.c
The flow is just:
- Open a libinput udev context
- Assign the seat
- Dispatch until some devices are present
- Suspend
Step 4 takes a significant amount of time on my machine.
Required information
- libinput version: 1.15.6