call detach on all threads before exiting

This commit is contained in:
Akshay Arora 2016-10-26 20:34:01 +05:30 committed by GitHub
parent 98596b37be
commit 9838660626
1 changed files with 11 additions and 0 deletions

View File

@ -36,3 +36,14 @@ class PythonJavaClass_(PythonJavaClass):
return self.hashCode() == other.hashCode()
PythonJavaClass = PythonJavaClass_
# from https://gist.github.com/tito/09c42fb4767721dc323d
import threading
orig_thread_run = threading.Thread.run
def thread_check_run(*args, **kwargs):
try:
return orig_thread_run(*args, **kwargs)
finally:
jnius.detach()
threading.Thread.run = thread_check_run