piborg / Gamepad

A simple library for getting game controller and joystick inputs into Python in Linux.
MIT License
101 stars 27 forks source link

.disconnect() / stopBackgroundUpdates() blocks forever if no gamepad events occur. #2

Closed herzig closed 2 years ago

herzig commented 4 years ago

Hi,

I think the background thread never terminates because stopBackgroundUpdates() just sets the running flag that is checked in a while loop. But _getNexEventRaw() blocks until there is an event. So, after stopBackgroundUpdates() is called, there needs to be one last event (i.e. a button press) until the flag is checked and the thread actually terminates.

Does anybody have a good idea on how to gracefully stop the update thread? (Ctrl-C works to just terminate the process, but that is not very nice.)