Changeset 1260

Show
Ignore:
Timestamp:
08/24/08 18:16:07 (19 months ago)
Author:
ahu
Message:

add rdtsc for timing infra, add call to make sockets reusable, make sure mtasker returns waitkey on timeout too

Location:
trunk/pdns/pdns
Files:
1 added
2 modified

Legend:

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

    r1256 r1260  
    2323 
    2424#if 0 
    25 #define RDTSC(qp) \ 
    26 do { \ 
    27   unsigned long lowPart, highPart;                                      \ 
    28   __asm__ __volatile__("cpuid"); \ 
    29   __asm__ __volatile__("rdtsc" : "=a" (lowPart), "=d" (highPart)); \ 
    30     qp = (((unsigned long long) highPart) << 32) | lowPart; \ 
    31 } while (0) 
    32  
    3325#include <iostream> 
    3426using std::cout; 
     
    383375} 
    384376 
     377inline void setSocketReusable(int fd) 
     378{ 
     379  int tmp=1; 
     380  setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&tmp, static_cast<unsigned>(sizeof tmp)); 
     381} 
     382 
    385383string stripDot(const string& dom); 
    386384void seedRandom(const string& source); 
  • trunk/pdns/pdns/mtasker.cc

    r1116 r1260  
    302302      if(i->ttd && (unsigned int)i->ttd < now) { 
    303303        d_waitstatus=TimeOut; 
     304        d_eventkey=i->key;        // pass waitEvent the exact key it was woken for 
    304305        ucontext_t* uc = i->context; 
    305306        ttdindex.erase(i++);                  // removes the waitpoint