Show
Ignore:
Timestamp:
09/22/09 12:14:43 (10 months ago)
Author:
ahu
Message:

implement timeouts with millisecond resolution, and raise the default timeout to 1500 msec.
In addition, the previous code may not actually have been delivering the "1 second" timeout accurately, this is now fixed

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/mtasker.hh

    r853 r1402  
    11/* 
    22    PowerDNS Versatile Database Driven Nameserver 
    3     Copyright (C) 2002 - 2006  PowerDNS.COM BV 
     3    Copyright (C) 2002 - 2009  PowerDNS.COM BV 
    44 
    55    This program is free software; you can redistribute it and/or modify 
     
    6666    EventKey key; 
    6767    ucontext_t *context; 
    68     time_t ttd; 
     68    struct timeval ttd; 
    6969    int tid; 
    7070  }; 
     
    7474    indexed_by < 
    7575                ordered_unique<member<Waiter,EventKey,&Waiter::key> >, 
    76                 ordered_non_unique<tag<KeyTag>, member<Waiter,time_t,&Waiter::ttd> > 
     76                ordered_non_unique<tag<KeyTag>, member<Waiter,struct timeval,&Waiter::ttd> > 
    7777               > 
    7878  > waiters_t; 
     
    9191 
    9292  typedef void tfunc_t(void *); //!< type of the pointer that starts a thread  
    93   int waitEvent(EventKey &key, EventVal *val=0, unsigned int timeout=0, unsigned int now=0); 
     93  int waitEvent(EventKey &key, EventVal *val=0, unsigned int timeoutMsec=0, struct timeval* now=0); 
    9494  void yield(); 
    9595  int sendEvent(const EventKey& key, const EventVal* val=0); 
    9696  void getEvents(std::vector<EventKey>& events); 
    9797  void makeThread(tfunc_t *start, void* val); 
    98   bool schedule(unsigned int now=0); 
     98  bool schedule(struct timeval* now=0); 
    9999  bool noProcesses(); 
    100100  unsigned int numProcesses();