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

Method schedule

src/iocore/eventsystem/P_UnixEventProcessor.h:93–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93TS_INLINE Event *
94EventProcessor::schedule(Event *e, EventType etype)
95{
96 ink_assert(etype < MAX_EVENT_TYPES);
97
98 if (TSSystemState::is_event_system_shut_down()) {
99 return nullptr;
100 }
101
102 EThread *affinity_thread = e->continuation->getThreadAffinity();
103 EThread *curr_thread = this_ethread();
104 if (affinity_thread != nullptr && affinity_thread->is_event_type(etype)) {
105 e->ethread = affinity_thread;
106 } else {
107 // Is the current thread eligible?
108 if (curr_thread != nullptr && curr_thread->is_event_type(etype)) {
109 e->ethread = curr_thread;
110 } else {
111 e->ethread = assign_thread(etype);
112 }
113 if (affinity_thread == nullptr) {
114 e->continuation->setThreadAffinity(e->ethread);
115 }
116 }
117
118 if (e->continuation->mutex) {
119 e->mutex = e->continuation->mutex;
120 }
121
122 if (curr_thread != nullptr && e->ethread == curr_thread) {
123 e->ethread->EventQueueExternal.enqueue_local(e);
124 } else {
125 e->ethread->EventQueueExternal.enqueue(e);
126 }
127
128 return e;
129}
130
131TS_INLINE Event *
132EventProcessor::schedule_imm(Continuation *cont, EventType et, int callback_event, void *cookie)

Callers

nothing calls this directly

Calls 6

this_ethreadFunction · 0.85
getThreadAffinityMethod · 0.80
is_event_typeMethod · 0.80
setThreadAffinityMethod · 0.80
enqueue_localMethod · 0.80
enqueueMethod · 0.45

Tested by

no test coverage detected