You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "sherlockhua (JIRA)" <ji...@apache.org> on 2014/03/03 09:20:21 UTC
[jira] [Updated] (TS-2605) delete unused code
[ https://issues.apache.org/jira/browse/TS-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
sherlockhua updated TS-2605:
----------------------------
Attachment: 0001-TS-2605-delete-unused-code-from-proxy-Main.cc.patch
delete unused code
> delete unused code
> ------------------
>
> Key: TS-2605
> URL: https://issues.apache.org/jira/browse/TS-2605
> Project: Traffic Server
> Issue Type: Improvement
> Components: Core, TProxy
> Reporter: sherlockhua
> Attachments: 0001-TS-2605-delete-unused-code-from-proxy-Main.cc.patch
>
>
> 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.
--
This message was sent by Atlassian JIRA
(v6.2#6252)