-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Fixed poor synchronization in XBPyThread::stop() #1221
Conversation
@@ -442,10 +445,27 @@ void XBPyThread::stop() | |||
PyThreadState_Swap(old); | |||
PyEval_ReleaseLock(); | |||
|
|||
if(!stoppedEvent.WaitMSec(5000))//let the script 5 secs for shut stuff down | |||
unsigned int checkpoint = XbmcThreads::SystemClockMillis(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
With above two changes, it should be a good fix. |
Fixed elupus's comment. What value should be used for WaitMSec(15)? I chose 15 because it's about 60fps. |
Should be fine. |
// dismantle themselves. Python dialogs aren't normal XBMC dialogs, they rely | ||
// on TMSG_GUI_PYTHON_DIALOG messages, so pump the render loop. | ||
CSingleLock lock(g_graphicsContext); | ||
g_windowManager.ProcessRenderLoop(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Updated the message processing part (see commit description) |
Rebased into single commit. @elupus any more thoughts? |
This fixes XBPyThread::stop() waiting on a event in the application thread, which precludes the event from getting triggered if a Python script relies on the messaging system to close itself (such as calling the .close() function on an open dialog)
Fixed poor synchronization in XBPyThread::stop()
Currently we only add the main language code with two letters: en, sv etc. Fixes xbmc#1221
Currently we only add the main language code with two letters: en, sv etc. Fixes xbmc#1221
This fixes XBPyThread::stop() waiting on a event in the application thread, which precludes the event from getting triggered if a Python script relies on the messaging system to close itself (such as calling the .close() function on an open dialog)
An alternative could be not ever calling ::stop() in the app thread. I don't know how feasible this is.
My strategy for handling messages comes from
https://github.com/xbmc/xbmc/blob/master/xbmc/cores/dvdplayer/DVDPlayer.cpp#L461
https://github.com/xbmc/xbmc/blob/master/xbmc/filesystem/Directory.cpp#L170
https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/GUIDialog.cpp#L176
and I've learned that just because it's done throughout the code base doesn't make it correct, consistent or complete. Always open to being pointed in the right direction :)