ADD: expose ActivateScreenSaver function to python. #1670

Closed
wants to merge 1 commit into
from

Projects

None yet

5 participants

@SlrG

This closes #1656.

@MartijnKaijser
Team Kodi member

@cptspiff
Since you semi commented in referenced PR. Is this ok for you?

@ghost

no. you cannot call that function off application thread.

@SlrG

@cptspiff:
Can you please explain a little further what you want me to change?

@mkortstiege
Team Kodi member

Please move the call to the ApplicationMessenger in order to keep the main application thread clean.

@ghost

as builtin commands can be called from any thread we need to take concurrency into account. there is no knowing what the application thread is doing and blindly activating the screensaver from another thread is doomed. we thus have to make sure that it is called at a safe point. this is where the application messenger comes in handy. this allows threads to send a message to the application thread and have it do some task at a safe point.

add a new message to be used by the builtin. appmessenger is monkey see monkey do buisiness

@ulion

@cptspiff I checked CBuiltins::Execute(), there's other codes looks should only be called in xbmc main thread. so could it possible we already make sure CBuiltins::Execute() is called in xbmc main thread?

@Montellese
Team Kodi member

@ulion: Only if it's called through CApplicationMessenger's execute builtins wrapper AFAIK.

@ulion

I didn't see any place calling CBuiltins::Execute() not in xbmc main thread, is there any?

@ghost

json python eventserver for off the top of my head examples

@ulion

if you mean the one called by CEventServer::ExecuteNextAction(), then it is not, which was called by CApplication::ProcessEventServer() and in xbmc main thread.

@ulion

on the other hand, even there's some place calling CBuiltins::Execute() not in xbmc main thread, as long as the calling params is hardcoded, it is not related to this new function. and I'm sure that in xbmc python calls XBMCAddon::xbmc::executebuiltin which then calls CApplicationMessenger::Get().ExecBuiltIn() so we need not do it again.

@ghost

fine i didnt dig all details. if all builtin calls from python are serialized we have a fuglier ahole to fill. that is just wrong.

@ghost ghost closed this Jun 8, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment