Thanks for your suggestions. IMHO the most appropriate way (but probably not easiest) is to use DBUS functionality as <span id="_user_exploderi@gmail.com" style="color: rgb(0, 0, 0);">Mika Yrjölä described. What do you think?
</span><br><br><div><span class="gmail_quote">On 11/15/07, <b class="gmail_sendername">Eero Tamminen</b> <<a href="mailto:eero.tamminen@nokia.com">eero.tamminen@nokia.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>ext Aleksandr Koltsoff wrote:<br>> Eero Tamminen wrote:<br>>> ext Aleksandr Koltsoff wrote:<br>>>> I think in your case it would be sufficient to do something like this:<br>>>> while true; do
<br>>>> ./run-your-application params<br>>>> sleep 2<br>>>> done<br>>>><br>>>> Or in C:<br>>>><br>>>> while(1) {<br>>>> system("./run-your-application params");
<br>>>> sleep(2);<br>>>> }<br>>> That would shorten the battery life. If one really needs/wants<br>>> to kludge things with polling, the interval should be several<br>>> times larger.
<br>><br>> When the application is running, both methods wait for the process to<br>> terminate, i.e., no polling. man 3 system. The idea originally was that<br>> should the application terminate, it will be restarted after a while.
<br><br>Sorry, I didn't read your mail properly (need to get new glasses<br>one of these days...), I just saw the "sleep 2".<br><br><br>> If the application is completely broken, and will fail to start in any
<br>> case, then this would amount to polling, and would shorten battery life.<br><br>This would happen also if the process daemonizes itself.<br><br><br>> My original post did suggest handling exit codes of the child properly,
<br>> but I guess that was lost somewhere in the process..<br>><br>>>> Linux (kernel) does not have a non-polling mechanism to track<br>>>> PID-existance for non-related processes.<br>>> It has, you just need to be the process parent. :-)
<br>><br>> Note the "non-related" part :-). Parent <-> child = related processes.<br><br><br> - Eero<br>_______________________________________________<br>maemo-developers mailing list<br><a href="mailto:maemo-developers@maemo.org">
maemo-developers@maemo.org</a><br><a href="https://lists.maemo.org/mailman/listinfo/maemo-developers">https://lists.maemo.org/mailman/listinfo/maemo-developers</a><br></blockquote></div><br><br clear="all"><br>-- <br>Cheers,
<br>Michael