Skip to content

Commit b8a048b

Browse files
committed
When using TSContSchedule() and TSContScheduleAPI() set the calling thread
as the thread affinity when not already set
1 parent 55abbd7 commit b8a048b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/traffic_server/InkAPI.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4527,7 +4527,8 @@ TSContSchedule(TSCont contp, TSHRTime timeout)
45274527

45284528
EThread *eth = i->getThreadAffinity();
45294529
if (eth == nullptr) {
4530-
return nullptr;
4530+
eth = this_ethread();
4531+
i->setThreadAffinity(eth);
45314532
}
45324533

45334534
TSAction action;
@@ -4634,7 +4635,8 @@ TSContScheduleEvery(TSCont contp, TSHRTime every /* millisecs */)
46344635

46354636
EThread *eth = i->getThreadAffinity();
46364637
if (eth == nullptr) {
4637-
return nullptr;
4638+
eth = this_ethread();
4639+
i->setThreadAffinity(eth));
46384640
}
46394641

46404642
TSAction action = reinterpret_cast<TSAction>(eth->schedule_every(i, HRTIME_MSECONDS(every)));

0 commit comments

Comments
 (0)