Magic number MAX_BLOCKTIME

Marc Lehmann schmorp at schmorp.de
Sun Dec 11 18:02:16 CET 2011


On Sun, Dec 11, 2011 at 02:11:32PM +0800, 龙第九子 <physacco at gmail.com> wrote:
>     #define MAX_BLOCKTIME 59.731 /* never wait longer than this time
> (to detect time jumps) */
> 
> Could you tell me how these values are determined? If I may ask.

by deliberation - it should not be too large (to detect time jumps
reasonably fast, to avoid limitations in os interfaces), and not too small
(to not wake up too often, to not confuse normal scheduling delays with
time jumps etc.), and preferably not coincide with other timers, for
efficiency.

what is too small and too large, and whether it should coincide or not,
depends on the application, but it's not normally very critical (which is
why it is a compile-time constant).

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list