Warning dialog for slow scripts?

Thomas Lübking thomas.luebking at web.de
Sun Feb 7 17:32:03 CET 2010


Am Sunday 07 February 2010 schrieb Mark Kretschmann:
> On Sun, Feb 7, 2010 at 8:47 AM, Mark Kretschmann <kretschmann at kde.org> 
wrote:
> > My plan for now:
> >
> > I will add a mock class of this dialog to Amarok today, which contains
> > the strings we need. This way we will gain more time, and we can at
> > least ignore the string freeze, which is very soon. Then we can still
> > see what to do.
> 
> Done, and pushed to mainline.
> 
> Some more brainstorming on the technical implementation: Instead of
> starting each script in its own thread (which wouldn't work, because
> you can't do GUI things in other threads), we could start one
> "Watcher" thread that somehow looks over the state of all scripts.
> 
> 
> Does that sound feasible?
A script running in and really blocking the UI thread requires launching an 
extra process + (at least socket) IPC for thread handling (as you cannot show 
the user a dialog inside amaroks UI thread ;-)

If scripts don't need access to the UI other than through signals & slots you 
should be able to "run" them in their own threads.

I've honestly no experience with amaroks scripting (most seems to be "radio 
station xyz), but a solution _could_ be to require "thread safe" scripts, i.e. 
have a script function that sets up an connects to the UI part on load and 
have the actual runtime script execution in an extra thread (with low/er 
priority)

This way at least the UI will not be blocked by 3rd party "bugs". (e.g. 
waiting for network response)
Maybe you need two class scripts for this (safe and legacy) and drop legacy 
support over the time.

Unfortunately this does still not prevent scripts from crashing amarok, sorry 
Myriam, but you need several processes and IPC for such, aka the chrome 
approach.

Cheers
Thomas



More information about the Amarok-devel mailing list