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

Method initThreadState

src/iocore/eventsystem/UnixEventProcessor.cc:486–506  ·  view source on GitHub ↗

This is called from inside a thread as the @a start_event for that thread. It chains to the startup events for the appropriate thread group start events.

Source from the content-addressed store, hash-verified

484// This is called from inside a thread as the @a start_event for that thread. It chains to the
485// startup events for the appropriate thread group start events.
486void
487EventProcessor::initThreadState(EThread *t)
488{
489 // Run all thread type initialization continuations that match the event types for this thread.
490 for (int i = 0; i < MAX_EVENT_TYPES; ++i) {
491 if (t->is_event_type(i)) {
492 // To avoid race conditions on the event in the spawn queue, create a local one to actually send.
493 // Use the spawn queue event as a read only model.
494 Event *nev = eventAllocator.alloc();
495 for (Event *ev = thread_group[i]._spawnQueue.head; nullptr != ev; ev = ev->link.next) {
496 nev->init(ev->continuation, 0, 0);
497 nev->ethread = t;
498 nev->callback_event = ev->callback_event;
499 nev->mutex = ev->continuation->mutex;
500 nev->cookie = ev->cookie;
501 ev->continuation->handleEvent(ev->callback_event, nev);
502 }
503 nev->free();
504 }
505 }
506}
507
508int
509EventProcessor::start(int n_event_threads, size_t stacksize)

Callers 1

initMethod · 0.80

Calls 5

is_event_typeMethod · 0.80
allocMethod · 0.45
initMethod · 0.45
handleEventMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected