[maemo-developers] Check if application is run
From: Eero Tamminen eero.tamminen at nokia.comDate: Thu Nov 15 11:20:16 EET 2007
- Previous message: Check if application is run
- Next message: Check if application is run
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, ext Michael Stepanov wrote: > Thanks for your suggestions. IMHO the most appropriate way (but probably not > easiest) is to use DBUS functionality as Mika Yrjölä described. What do you > think? It depends from whether you're going to use D-BUS for anything else than launching the application (do you need to listen to system events for example like all the pre-installed applications) and how much you care about user not running multiple instances of the application at the same time (accidentally). Some SDL programs for example don't use D-BUS (games might have a Gtk/Hildon UI wrapper for them using D-BUS though). - Eero > On 11/15/07, Eero Tamminen <eero.tamminen at nokia.com> wrote: >> Hi, >> >> ext Aleksandr Koltsoff wrote: >>> Eero Tamminen wrote: >>>> ext Aleksandr Koltsoff wrote: >>>>> I think in your case it would be sufficient to do something like this: >>>>> while true; do >>>>> ./run-your-application params >>>>> sleep 2 >>>>> done >>>>> >>>>> Or in C: >>>>> >>>>> while(1) { >>>>> system("./run-your-application params"); >>>>> sleep(2); >>>>> } >>>> That would shorten the battery life. If one really needs/wants >>>> to kludge things with polling, the interval should be several >>>> times larger. >>> When the application is running, both methods wait for the process to >>> terminate, i.e., no polling. man 3 system. The idea originally was that >>> should the application terminate, it will be restarted after a while. >> Sorry, I didn't read your mail properly (need to get new glasses >> one of these days...), I just saw the "sleep 2". >> >> >>> If the application is completely broken, and will fail to start in any >>> case, then this would amount to polling, and would shorten battery life. >> This would happen also if the process daemonizes itself. >> >> >>> My original post did suggest handling exit codes of the child properly, >>> but I guess that was lost somewhere in the process.. >>> >>>>> Linux (kernel) does not have a non-polling mechanism to track >>>>> PID-existance for non-related processes. >>>> It has, you just need to be the process parent. :-) >>> Note the "non-related" part :-). Parent <-> child = related processes. >> >> - Eero >> _______________________________________________ >> maemo-developers mailing list >> maemo-developers at maemo.org >> https://lists.maemo.org/mailman/listinfo/maemo-developers >> > > >
- Previous message: Check if application is run
- Next message: Check if application is run
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]