You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Cliff Woolley <jw...@virginia.edu> on 2003/08/20 06:43:33 UTC

alarm()

I was hoping there would be some kind of APR equivalent of alarm(2), but
there's not.  Nor can I find any Win32 equivalent.  Anybody know what it
is?

--Cliff

Re: alarm()

Posted by Cliff Woolley <jw...@virginia.edu>.
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

Re: alarm()

Posted by Jeff Trawick <tr...@attglobal.net>.
Cliff Woolley wrote:

> I was hoping there would be some kind of APR equivalent of alarm(2), but
> there's not.  Nor can I find any Win32 equivalent.  Anybody know what it
> is?

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?