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

Remove xbmc.abortRequested flag #160

Merged
merged 3 commits into from
Sep 12, 2020
Merged

Remove xbmc.abortRequested flag #160

merged 3 commits into from
Sep 12, 2020

Conversation

MilhouseVH
Copy link
Contributor

bluetooth::stop_service() and bluetooth::exit() are being executed concurrently on kodi
shutdown if the user is in the Bluetooth window during shutdown. Both functions are
checking for, and then deleting, self.discovery_thread.

Since only one of the function calls will successfully delete self.discovery_thread, the
other function call will throw an AttributeError exception. The problem is that the
check-then-delete pattern is not thread safe - the object can be deleted in the first
thread after it has been checked (but before it is deleted) in the second thread.

Ignoring the exception is a hack until someone cares to fix it properly.
@MilhouseVH
Copy link
Contributor Author

I've left a couple of time.sleep(0.2) calls, here:

time.sleep(0.2)

and here:

time.sleep(0.2)

mainly because switching to xbmcm.waitForAbort(0.2) would require additional refactoring as it's not clear/obvious what should happen if the abort occurs during either loop - falling out of the loop when it's not safe to read/write the config isn't really an option, and returning without loading or saving the config probably isn't desirable either.

Given that that these 2 loops should be very short I've left them as they are.

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