TSCONTSCHEDULEEVERY(3ts)

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

πŸ¦‹ TSCONTSCHEDULEEVERY ✨

okay bestie, this one's from Apache Traffic Server, it lives in manual section 3ts, and it's literally just called TSContScheduleEvery. it's the API function for... scheduling stuff every so often. iconic behaviour honestly πŸ’…


🌸 NAME 🌸

TSContScheduleEvery β€” the TSContScheduleEvery API function. yeah that's it, that's the whole name. short king energy πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <ts/ts.h>

TSAction TSContScheduleEvery(TSCont contp, TSHRTime every)

like... that's the whole vibe. two args, one return value, go off 🫢


πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie β˜• β€” TSContScheduleEvery schedules contp to periodically run every delay milliseconds in the future. key word: periodically. she comes back. she's consistent. we love that for her 🌈

now, this timing is approximate, and I need you to internalize that fr fr. the delay will be at least delay, but possibly more. so like, she's never early, but she is sometimes late. fashionably. πŸ¦‹

and the resolution? anything finer than roughly 5 milliseconds will simply not be effective. so don't come at her with your microsecond dreams, she's not that girl πŸ’€

oh and β€” contp is required to have a mutex, which is provided to TSContCreate(). no mutex, no scheduling. non-negotiable, periodt βœ‹

🌟 the return value, explained 🌟

the return value can be used to cancel the scheduled event via TSActionCancel(). and this is effective until the continuation contp is being dispatched. so like, once she's out there being dispatched, that cancel button stops working, sorry bestie 😭

however!! if it is scheduled on another thread, this can be problematic to be correctly timed. threading is messy, that's just the truth πŸ™ˆ

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. sneaky little race condition, love that for us πŸ’€

and it returns nullptr if thread affinity was cleared. no affinity, no action, no vibes πŸ’”

πŸ’œ the affinity situation πŸ’œ

TSContSchedule() or TSContScheduleEvery() will default to set the thread affinity to the calling thread when no affinity is already set β€” for example, using TSContThreadAffinitySet(). she picks a thread and she sticks with it. loyal πŸ₯Ή

🚨 the big warning 🚨

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. do NOT do this. I'm serious. unpredictable behaviour is the scary kind, not the fun kind 😭πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

  • TSContSchedule
  • TSContScheduleOnPool
  • TSContScheduleOnThread

go read those next, they're all in the same friend group 🫢


2026, dev@trafficserver.apache.org


and that's the whole page bestie, no cap ✨ this was version 9.2, dated Feb 12, 2026, from the TSCONTSCHEDULEEVERY(3ts) era of the Apache Traffic Server world. now go schedule something responsibly, with a mutex, from an EThread, and absolutely not from a raw non-EThread. mwah πŸ’…πŸ’–πŸŒΈ

πŸ“¦ where this page comes from