pendingcalls without timeout

Havoc Pennington hp at redhat.com
Mon Mar 15 15:06:00 PST 2004


On Mon, 2004-03-15 at 15:43, Anders Gustafsson wrote:
> However there is also some calls "wait until status changes and report
> it". However, pending calls have a timeout, and that call might take
> some time to return (in the range milliseconds to days). I see no
> reason why pending calls MUST have a timeout. Could someone please
> care to explain?

There's a comment in the code right above where the max timeout is
implemented:

 /* it would probably seem logical to pass in _DBUS_INT_MAX
   * for infinite timeout, but then math below would get
   * all overflow-prone, so smack that down.
   */
  if (timeout_milliseconds > _DBUS_ONE_HOUR_IN_MILLISECONDS * 6)
    timeout_milliseconds = _DBUS_ONE_HOUR_IN_MILLISECONDS * 6;
  
If you want to carefully work out all the overflow issues and address
them in a more complex way you could change the max timeout to something
other than 6 hours. There's always going to be a max though if only
32-bit signed int max, which I work out to be about 600 hours.

A simpler solution is probably:
 
 message = NULL;
 while (message == NULL)
   message = block_for_reply ();

in your clients.

Havoc





More information about the dbus mailing list