[maemo-developers] Check if application is run

From: Aleksandr Koltsoff czr at iki.fi
Date: Wed Nov 7 12:57:48 EET 2007

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?

I think in your case it would be sufficient to do something like this:
while true; do
  ./run-your-application params
  sleep 2

Or in C:

while(1) {
  system("./run-your-application params");

Linux (kernel) does not have a non-polling mechanism to track
PID-existance for non-related processes (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.


More information about the maemo-developers mailing list