TSCONTSCHEDULE(3ts)

πŸ“¦
version 9.2.5 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– 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 the TSContSchedule() family of API shall only be called from an ATS EThread. 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:

  • TSContScheduleEvery
  • TSContScheduleOnPool
  • TSContScheduleOnThread

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