TSCONTSCHEDULE(3ts)
π TSCONTSCHEDULE β the "run this later bestie" function π
okay so real talk, this is TSContSchedule, an Apache Traffic Server API function, and it is literally the "girl I'll text you back in a sec" of the ATS world. no cap.
β¨ SYNOPSIS β¨
#include <ts/ts.h>
TSAction TSContSchedule(TSCont contp, TSHRTime timeout)
like, that's the whole vibe. two args, one action. she's simple, she's iconic.
πΈ DESCRIPTION πΈ
so what does she do? She schedules contp to run delay milliseconds in the future. and I need you to hear me when I say: this is approximate. the delay will be at least delay, but possibly more. so if you were hoping for sub-millisecond precisionβ¦ no ma'am. resolutions finer than roughly 5 milliseconds will not be effective. that's just how she is. π«Ά
also, contp is required to have a mutex, which is provided to TSContCreate(). no mutex, no scheduling, periodt.
π about that return value π
the return value can be used to cancel the scheduled event via TSActionCancel(). this is effective until the continuation contp is being dispatched. that's the window, bestie, use it wisely.
howeverβ¦ if it is scheduled on another thread this can be problematic to be correctly timed. π not me being honest about the chaos.
the return value can also be checked with TSActionDone() to see if the continuation ran before the return β which is possible if timeout is 0. and it returns nullptr if thread affinity was cleared. (so like, check your return value, queen. don't ignore her.)
π¦ thread affinity tea π¦
TSContSchedule() or TSContScheduleEvery() will default to set the thread affinity to the calling thread when no affinity is already set β for example, using TSContThreadAffinitySet(). it just does that. it's a whole thing. π
β οΈ big warning, no joke: note that theTSContSchedule()family of API shall only be called from an ATSEThread. calling it from raw non-EThreads can result in unpredictable behavior. like, actual chaos. do not do this. π
π SEE ALSO π
go read these next, bestie, they're the rest of the squad:
TSContScheduleEveryTSContScheduleOnPoolTSContScheduleOnThread
π COPYRIGHT π
2026, dev@trafficserver.apache.org
and that's the page! version 9.2, dated Feb 12, 2026 β mwah, sending you off with all my love, go schedule something responsibly πβ¨π
π¦ where this page comes from
- ubuntu noble: trafficserver-dev 9.2.3+ds-1+deb12u1ubuntu0.1 Β· Apache-2.0
- ubuntu questing: trafficserver-dev 9.2.5+ds-1ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms