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.

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.
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.

ak.
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to