#include <ts/ts.h>
TSReturnCode TSContThreadAffinitySet(TSCont contp, TSEventThread ethread)


Set the thread affinity of continuation contp to ethread. Future calls to TSContScheduleOnPool(), and TSContScheduleOnPool() that has the same type as ethread will schedule the continuation on ethread, rather than an arbitrary thread of that type.

TSContScheduleOnPool() and TSContScheduleEveryOnPool() will default the affinity to calling thread when invoked without explicitly setting the thread affinity.

Return Values

TS_SUCCESS if thread affinity of continuation contp was set to ethread, TS_ERROR if not.