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...
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
