Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-2605

delete unused code

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0
    • Core, TProxy

    Description

      I'm newer to the traffic server project, when I read the source code, I found this code snippets have not used. in proxy/Main.cc, 1350 line. the code sippnets is like follow:

      1347 // This call is required for win_9xMe
      1348 //without this this_ethread() is failing when
      1349 //start_HttpProxyServer is called from main thread
      1350 Thread *main_thread = NEW(new EThread);
      1351 main_thread->set_specific();

      but I found when eventProcessor.start(num_of_net_threads, stacksize) is execute, in function start of eventProcessor will overwrite the thread specific data which set above, here is the code snippets:

      130 EventProcessor::start(int n_event_threads, size_t stacksize)
      131 {
      132 char thr_name[MAX_THREAD_NAME_LENGTH];
      133 int i;
      134
      135 // do some sanity checking.
      136 static int started = 0;
      137 ink_release_assert(!started);
      138 ink_release_assert(n_event_threads > 0 && n_event_threads <= MAX_EVENT_THREADS);
      139 started = 1;
      140
      141 n_ethreads = n_event_threads;
      142 n_thread_groups = 1;
      143
      144 int first_thread = 1;
      145
      146 for (i = 0; i < n_event_threads; i++) {
      147 EThread *t = NEW(new EThread(REGULAR, i));
      148 if (first_thread && !i)

      { 149 ink_thread_setspecific(Thread::thread_data_key, t); //overwrite 150 global_mutex = t->mutex; 151 t->cur_time = ink_get_based_hrtime_internal(); 152 }

      153 all_ethreads[i] = t;
      154
      155 eventthread[ET_CALL][i] = t;
      156 t->set_event_type((EventType) ET_CALL);
      157 }

      so I think the main_thread should discarded, and make code more clear to read, thank you.

      Attachments

        Activity

          People

            psudaemon Phil Sorber
            hua zhang sherlockhua
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: