Changeset 652

Show
Ignore:
Timestamp:
04/04/06 14:13:37 (7 years ago)
Author:
ahu
Message:

remove unused 'title' facility from MTasker - saving a lot of string copies

Location:
trunk/pdns/pdns
Files:
3 modified

Legend:

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

    r628 r652  
    190190{ 
    191191  d_runQueue.push(d_tid); 
    192   if(swapcontext(d_threads[d_tid].first ,&d_kernel) < 0) { // give control to the kernel 
     192  if(swapcontext(d_threads[d_tid] ,&d_kernel) < 0) { // give control to the kernel 
    193193    perror("swapcontext in  yield"); 
    194194    exit(EXIT_FAILURE); 
     
    230230    \param val A void pointer that can be used to pass data to the thread 
    231231*/ 
    232 template<class Key, class Val>void MTasker<Key,Val>::makeThread(tfunc_t *start, void* val, const string& name) 
     232template<class Key, class Val>void MTasker<Key,Val>::makeThread(tfunc_t *start, void* val) 
    233233{ 
    234234  ucontext_t *uc=new ucontext_t; 
     
    245245  makecontext (uc, (void (*)(void))threadWrapper, 4, this, start, d_maxtid, val); 
    246246#endif 
    247   d_threads[d_maxtid]=make_pair(uc, name); 
     247  d_threads[d_maxtid]=uc; 
    248248  d_runQueue.push(d_maxtid++); // will run at next schedule invocation 
    249249} 
     
    264264  if(!d_runQueue.empty()) { 
    265265    d_tid=d_runQueue.front(); 
    266     if(swapcontext(&d_kernel, d_threads[d_tid].first)) { 
     266    if(swapcontext(&d_kernel, d_threads[d_tid])) { 
    267267      perror("swapcontext in schedule"); 
    268268      exit(EXIT_FAILURE); 
     
    273273  } 
    274274  if(!d_zombiesQueue.empty()) { 
    275     delete[] (char *)d_threads[d_zombiesQueue.front()].first->uc_stack.ss_sp; 
    276     delete d_threads[d_zombiesQueue.front()].first; 
     275    delete[] (char *)d_threads[d_zombiesQueue.front()]->uc_stack.ss_sp; 
     276    delete d_threads[d_zombiesQueue.front()]; 
    277277    d_threads.erase(d_zombiesQueue.front()); 
    278278    d_zombiesQueue.pop(); 
  • trunk/pdns/pdns/mtasker.hh

    r596 r652  
    7171  waiters_t d_waiters; 
    7272 
    73   typedef std::map<int,pair<ucontext_t*,string> > mthreads_t; 
     73  typedef std::map<int,ucontext_t* > mthreads_t; 
    7474  mthreads_t d_threads; 
    7575  int d_tid; 
     
    9696  int sendEvent(const EventKey& key, const EventVal* val=0); 
    9797  void getEvents(std::vector<EventKey>& events); 
    98   void makeThread(tfunc_t *start, void* val, const string& name=""); 
     98  void makeThread(tfunc_t *start, void* val); 
    9999  bool schedule(); 
    100100  bool noProcesses(); 
    101101  unsigned int numProcesses(); 
    102102  int getTid();  
    103   void setTitle(const string& name) 
    104   { 
    105     d_threads[d_tid].second=name; 
    106   } 
    107103 
    108104private: 
  • trunk/pdns/pdns/pdns_recursor.cc

    r647 r652  
    772772       
    773773      if(!((counter++)%500))  
    774         MT->makeThread(houseKeeping,0,"housekeeping"); 
     774        MT->makeThread(houseKeeping,0); 
    775775      if(statsWanted) { 
    776776        doStats(); 
     
    887887                dc->setSocket(*i); 
    888888                dc->d_tcp=false; 
    889                 MT->makeThread(startDoResolve, (void*) dc, "udp"); 
     889                MT->makeThread(startDoResolve, (void*) dc); 
    890890              } 
    891891            } 
     
    10371037                ++g_stats.qcounter; 
    10381038                ++g_stats.tcpqcounter; 
    1039                 MT->makeThread(startDoResolve, dc, "tcp"); 
     1039                MT->makeThread(startDoResolve, dc); 
    10401040              } 
    10411041            }