TSCONTTHREADAFFINITYSET(3ts)

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

πŸ’– TSCONTTHREADAFFINITYSET πŸ’–

okay bestie, welcome to the Apache Traffic Server manual, section 3ts. today's main character is TSContThreadAffinitySet β€” the API function that lets you pick exactly which event thread your continuation gets to hang out on. no more "wherever the scheduler feels like it" energy. we're choosing. we're committing. periodt. πŸ‘‘


✨ NAME ✨

TSContThreadAffinitySet β€” the TSContThreadAffinitySet API function πŸŽ€


🌸 SYNOPSIS 🌸

#include <ts/ts.h>

TSReturnCode TSContThreadAffinitySet(TSCont contp, TSEventThread
ethread)

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: you call this and you set the thread affinity of the continuation contp to ethread. like, you're basically matchmaking your continuation with a specific event thread and saying "this one. this is the one. πŸ’…"

From then on, any future calls to TSContSchedule(), plus any TSContScheduleOnPool() calls that have the same type as ethread, will schedule the continuation on ethread β€” instead of yeeting it onto some arbitrary thread of that type. no cap. it's giving ✨destiny✨.

Also important, and lowkey the plot twist: TSContSchedule() and TSContScheduleEvery() will default the affinity to the calling thread when you invoke them without explicitly setting the thread affinity. so if you never call this function, the calling thread is the default bestie. 🫢


πŸ’« RETURN VALUES πŸ’«

  • TS_SUCCESS β€” yay! πŸŽ‰ the thread affinity of continuation contp was set to ethread.
  • TS_ERROR β€” nope. 😭 it was not.

2026, dev@trafficserver.apache.org


and that's the whole page, bestie. every flag, every value, every word β€” untouched, just ✨glowed up✨. go set some thread affinity, you iconic thing. πŸŒˆπŸ’œ

9.2 β€” Feb 12, 2026 β€” TSCONTTHREADAFFINITYSET(3ts) 🌸 slay, bye!! πŸ’…βœ¨

πŸ“¦ where this page comes from