TSCONTSCHEDULEEVERY(3ts)
π¦ 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 π
TSContScheduleTSContScheduleOnPoolTSContScheduleOnThread
go read those next, they're all in the same friend group π«Ά
π COPYRIGHT π
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
- 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