Hi, ext Aleksandr Koltsoff wrote: > Michael Stepanov wrote: >> when the SDL program crashed by some reason to run it again. What is the >> most efficient way to periodically check something in the Maemo SDK?
If you exec it directly, just use wait/waitpid(). No need for polling. > 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. > 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. :-) > (adding this is not that hard, > one hooks into the same logic that is used for BSD style process > accounting, but this isn't present in stock kernel). > > Obviously you'll want to also check the reason why your application > "crashed" and act on that (branching on the exit code) but that was > omitted from the above snippets. For a crazy hack (nothing you would offer for others), one can install in Chinook a core dump handler (using '|' in the /proc core pattern). - Eero _______________________________________________ maemo-developers mailing list maemo-developers@maemo.org https://lists.maemo.org/mailman/listinfo/maemo-developers