Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to shutdown inputs? #92

Open
u2ros opened this issue Apr 21, 2020 · 2 comments
Open

How to shutdown inputs? #92

u2ros opened this issue Apr 21, 2020 · 2 comments

Comments

@u2ros
Copy link

u2ros commented Apr 21, 2020

Hi, i am running inputs in a python threading.Thread custom class. Therun methond looks like this:

while True:
    events = inputs.get_gamepad()
    #process events

Usually i shutdown a thread by using a running flag in the while loop, or, when using a threading.queue i send a None task which then breaks the loop on shutdown.

None of these methods is applicable here, since the run method only fires when events are rad from get_gamepad(). Any idea how to kill this thrad from another thread?

@u2ros
Copy link
Author

u2ros commented Apr 22, 2020

Or should i say... get_gamepad() blocks...

@vke-code
Copy link

vke-code commented Feb 15, 2021

I too am having the same issue. I am starting two threads to monitor keyboard and mouse events. I am unable to .join() the threads after setting a shutdown flag as they are blocking on the read(). I have yet to find a flag or interrupt that can shutdown inputs cleanly.

def keyboard_handler(self): while self.run_keyboard_handler: events = self.keyboard.read() for event in events: self.process_event(event)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants