MCPcopy Create free account
hub / github.com/apache/trafficserver / initialize_thread_for_net

Function initialize_thread_for_net

src/iocore/net/UnixNet.cc:166–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164};
165
166void
167initialize_thread_for_net(EThread *thread)
168{
169 NetHandler *nh = get_NetHandler(thread);
170
171 new (reinterpret_cast<ink_dummy_for_new *>(nh)) NetHandler();
172 new (reinterpret_cast<ink_dummy_for_new *>(get_PollCont(thread))) PollCont(thread->mutex, nh);
173 nh->mutex = new_ProxyMutex();
174 nh->thread = thread;
175
176 PollCont *pc = get_PollCont(thread);
177 PollDescriptor *pd = pc->pollDescriptor;
178
179 InactivityCop *inactivityCop = new InactivityCop(get_NetHandler(thread)->mutex);
180 int cop_freq = 1;
181
182 REC_ReadConfigInteger(cop_freq, "proxy.config.net.inactivity_check_frequency");
183 memcpy(&nh->config, &NetHandler::global_config, sizeof(NetHandler::global_config));
184 nh->configure_per_thread_values();
185 thread->schedule_every(inactivityCop, HRTIME_SECONDS(cop_freq));
186
187 thread->set_tail_handler(nh);
188
189#if HAVE_EVENTFD
190#if TS_USE_LINUX_IO_URING
191 auto ep = new IOUringEventIO();
192 ep->start(pd, IOUringContext::local_context());
193#else
194 auto ep = new AsyncSignalEventIO();
195 ep->start(pd, thread->evfd, EVENTIO_READ);
196#endif
197#else
198 auto ep = new AsyncSignalEventIO();
199 ep->start(pd, thread->evpipe[0], EVENTIO_READ);
200#endif
201 thread->ep = ep;
202}

Callers

nothing calls this directly

Calls 8

get_NetHandlerFunction · 0.85
get_PollContFunction · 0.85
new_ProxyMutexFunction · 0.85
set_tail_handlerMethod · 0.80
memcpyFunction · 0.50
schedule_everyMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected