This closes #1656.
ADD: expose ActivateScreenSaver function to python.
Since you semi commented in referenced PR. Is this ok for you?
no. you cannot call that function off application thread.
Can you please explain a little further what you want me to change?
Please move the call to the ApplicationMessenger in order to keep the main application thread clean.
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
@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?
@ulion: Only if it's called through CApplicationMessenger's execute builtins wrapper AFAIK.
I didn't see any place calling CBuiltins::Execute() not in xbmc main thread, is there any?
json python eventserver for off the top of my head examples
if you mean the one called by CEventServer::ExecuteNextAction(), then it is not, which was called by CApplication::ProcessEventServer() and in xbmc main thread.
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.
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.