Skip to content

InputDevice destructor blocks #144

Closed

Description

@sezanzeb
#!/usr/bin/python3
import evdev

def a():
    print([evdev.InputDevice(path) for path in evdev.list_devices()])

a()
print('end')

Various InputDevice objects are printed immediately, but it takes a second until 'end' appears because function a seems to be exited with a delay. If you multiply list_devices() the delay becomes longer.

It seems very odd that a function that prints the result then takes additional time to exit, seemingly doing nothing at all. Is there some blocking stuff in InputDevice destructors going on? It seems the delay happens as soon as the InputDevice objects are not needed anymore.

  • Python 3.8.5 (default, Sep 5 2020, 10:50:12)
  • extra/python-evdev 1.3.0-1

Activity

  1. changed the title [-]Function blocks for a second with sudo[/-] [+]InputDevice destructor blocks[/+] on Nov 16, 2020
  2. sezanzeb commented on Nov 16, 2020

    @sezanzeb
    CollaboratorAuthor

    It's

    os.close(self.fd)
    that takes the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions