+1 for APIs that allow scheduling on an arbitrary thread On Wed, 15 Aug 2018 at 03:37, Kees Spoelstra <kspoels...@we-amp.com> wrote:
> +1, we currently have it implemented but did not come around to make a pull > request and a proposal. > > Some remarks, instead of current thread we should be able to schedule on an > arbitrary thread (*OnThread) > > This can also improve performance by preventing thread jumping and provide > simpler concurrency because there is no concurrency :) > > Not having access to source code, but I recall the change not being too > big, it is mostly adding the thread to some calls. > > If people are interested I'll try to provide a pr in the next two days > > > On Wed, Aug 15, 2018, 08:58 zzz <z...@apache.org> wrote: > > > Hi, team, > > > > The background here is we'd like to clean up a thread local cache after > > some timeout. Unfortunately, we're lacking an API to schedule a > > continuation to the current thread. > > > > There are two ways I can think of to achieve this. > > One is a pair of new APIs *TSContScheduleToCurrentThread(TSCont contp, > > ink_hrtime timeout) *and* TSContScheduleToCurrentThreadEvery(TSCont > contp, > > ink_hrtime every).* > > Or we can append the TSThreadPool enum with a new entry called > > *TS_THREAD_CURRENT > > *and add the logic into *TSContSchedule() *and *TSContScheduleEvery(). * > > The issue with the latter solution is *TS_THREAD_CURRENT* doesn't quite > fit > > in TSThreadPool. If we change TSThreadPool to some more proper name, the > > change will not be backward compatible. > > > > Please feel free to share your insights. Any ideas would be much > > appreciated! > > > > > > Thanks, > > Zizhong > > >