qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Stitcher <astitc...@redhat.com>
Subject Re: API question
Date Mon, 05 Nov 2007 15:40:43 GMT
On Mon, 2007-11-05 at 15:37 +0000, Andrew Stitcher wrote:
> On Mon, 2007-11-05 at 10:26 -0500, Alan Conway wrote:
> > I want to add a timeout to the public API (I'm adding "get" style
> > subscription as an alternative to "listen" style)
> > 
> > Opinions, should I:
> > a) use qpid::sys::Duration as the timeout parameter?
> > b) use uint64_t nanosecond value?
> > c) do something else...

Actually, to reply to myself, I guess it's probably best to provide both
a duration and an absolute time version. to give the users a choice.

Andrew

> 
> c) I think it's usually better to specify timeouts in terms of an
> absolute "wait until" time (I know this isn't the common practice).
> 
> The reason is that the if waiting gets interrupted for some reason other
> than timeout or completion (signal for instance) then all you need to do
> to carry on is the same operation again. I suppose I'm saying this
> operation is idempotent.
> 
> If you specify a duration then you need to calculate the absolute
> waiting time internally to do this, or return the remaining time like
> the Linux select does.
> 
> Incidentally this time shouldn't be related to the clock time rather to
> the uptime, just in case someone changes the clock on you (you're
> running NTP that sort of thing).
> 
> Not sure if this helps!
> 
> Andrew
> 


Mime
View raw message