On Wed, 20 Aug 2003, Jeff Trawick wrote: > ain't none > > do you want a piece of code called every so often or do you want to > unblock some call after a period of inactivity?
There's this library called lp_solve (which solves linear programs) I'm using that, every once in a while, will go into an infinite loop while trying to solve a system of linear equations you've given it (presumably due to floating point precision problems). It has a set of countermeasures whereby it injects small perturbations to try to get out of those loops, but when I tried enabling that feature, it only made the problem worse. Unfortunately it is very hard to detect the cases that cause these loops in the first place prior to calling lp->solve() -- and once you do that, you're hosed. So I figured rather than fighting the solver for another few months (as I've done in the past), I'd just set an alarm(). These are relatively small lp's I'm solving... if it takes more than, say, a few hundred milliseconds, it will never converge. So an alarm to kick it out of the loop after maybe two seconds would be excellent. (I'd much rather have a "don't know" answer than no answer at all.) Anyway, since I'm already using APR in the program that also uses lp_solve, I was hoping APR would help me work around my problem with the other library. But there are no alarms in APR. :-/ --Cliff