Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions iocore/eventsystem/P_UnixEventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ EventProcessor::schedule(Event *e, EventType etype, bool fast_signal)
if (ethread != nullptr && ethread->is_event_type(etype)) {
e->ethread = ethread;
} else {
e->ethread = assign_thread(etype);
if (ethread == nullptr) {
ethread = this_ethread();
// Is the current thread eligible?
if (ethread != nullptr && ethread->is_event_type(etype)) {
e->ethread = ethread;
} else {
e->ethread = assign_thread(etype);
}
if (e->continuation->getThreadAffinity() == nullptr) {
e->continuation->setThreadAffinity(e->ethread);
}
}
Expand Down
3 changes: 1 addition & 2 deletions tests/gold_tests/cont_schedule/gold/schedule_on_pool.gold
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
``ET_NET``TSContScheduleOnPool handler 1``
``(TSContSchedule_test.check) pass [should not be the same thread]
``ET_TASK``TSContScheduleOnPool handler 2``
``(TSContSchedule_test.check) pass [should not be the same thread]
``ET_TASK``TSContScheduleOnPool handler 2``
``(TSContSchedule_test.check) pass [should not be the same thread]
``(TSContSchedule_test.check) pass [should be the same thread]
``
8 changes: 4 additions & 4 deletions tests/tools/plugins/cont_schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TSContScheduleOnPool_handler_1(TSCont contp, TSEvent event, void *edata)
} else {
TSDebug(DEBUG_TAG_CHK, "fail [on the same thread]");
}
check_thread = TSThreadSelf();
check_thread = nullptr;
}
return 0;
}
Expand All @@ -115,10 +115,10 @@ TSContScheduleOnPool_handler_2(TSCont contp, TSEvent event, void *edata)
if (check_thread == nullptr) {
check_thread = TSThreadSelf();
} else {
if (check_thread != TSThreadSelf()) {
TSDebug(DEBUG_TAG_CHK, "pass [should not be the same thread]");
if (check_thread == TSThreadSelf()) {
TSDebug(DEBUG_TAG_CHK, "pass [should be the same thread]");
} else {
TSDebug(DEBUG_TAG_CHK, "fail [on the same thread]");
TSDebug(DEBUG_TAG_CHK, "fail [not the same thread]");
}
check_thread = TSThreadSelf();
}
Expand Down