apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: APR - Setting Generic Timers
Date Thu, 22 Jan 2004 14:09:35 GMT
Wray Ferrell wrote:

> Having spent a few days looking at what APR has
> to offer, I noticed that there does not appear to
> be anyway to set a generic timer. The functions
> apr_thread_cond_timedwait put the thread to sleep
> while waiting for either the condition to be fullfilled
> or the timeout to occur. What I am looking for, and
> feel sure I overlooked, is the ability for a thread to
> set a timer with an expiration and a callback function.
> 
> For example, use a VOIP phone using the SIP protocol.
> The phone sends out an INVITE and then sets a timer
> with a callback function. If that timer pops the phone
> knows that no response to the initial INVITE has been
> recieved so the phone will re-transmit the INVITE.
> However this thread cannot sleep because it must still
> process data from the DSP, the user could decide to
> hangup, etc...
> 
> How would this be modeled in APR or is APR a
> purely event-driven model?

The first question to ask is: is this a facility that can be provided on 
all (or at least most) systems we support? Because if it isn't, it isn't 
a candidate for APR.

If it is, then we would certainly consider adding it. Don't think we do 
it right now, though.

OTOH, the thing I'm trying to resolve (slowly) is how to do 
cross-platform select() or poll() that works on more than just sockets 
(in particular, pipes, too). With that, you can get what you want using 
the time-out argument. Which is probably better and simpler anyway.

Cheers,

Ben.

-- 
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Mime
View raw message