TSContScheduleOnThread

Synopsis

#include <ts/ts.h>
TSAction TSContScheduleOnThread(TSCont contp, TSHRTime timeout, TSEventThread ethread)

Description

Schedules contp to run timeout milliseconds in the future, on the thread specified by ethread. The timeout is an approximation, meaning it will be at least timeout milliseconds but possibly more. Resolutions finer than roughly 5 milliseconds will not be effective. Note that contp is required to have a mutex, which is provided to TSContCreate().

The return value can be used to cancel the scheduled event via TSActionCancel(). This is effective until the continuation contp is being dispatched. However, if it is scheduled on another thread this can be problematic to be correctly timed. The return value can be checked with TSActionDone() to see if the continuation ran before the return, which is possible if timeout is 0.

If contp has no thread affinity set, the thread it is now scheduled on will be set as its thread affinity thread.

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.

See Also

TSContScheduleOnPool TSContScheduleOnEntirePool TSContScheduleEveryOnPool TSContScheduleEveryOnThread TSContScheduleEveryOnEntirePool