You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Fei Deng <fe...@yahooinc.com.INVALID> on 2023/10/17 13:25:30 UTC

Proposed new TS API function: TSContScheduleOnEntirePool

tsapi::c::TSAction
tsapi::c::TSContScheduleEveryOnEntirePool(TSCont contp, TSHRTime every,
TSThreadPool tp);

With this we can schedule a continuation on all the threads of a certain
type, e.g. ET_NET, ET_TASK, etc.

Currently we have a similar capability internally, but only when spawning
new thread pools

Event *EventProcessor::schedule_spawn();

We probably should also implement a TSContScheduleEvery variant along with
it.

-- 
Regards,
Fei Deng

Re: Proposed new TS API function: TSContScheduleOnEntirePool

Posted by Fei Deng <du...@apache.org>.
Updating the API prototypes a little here to reflect the changes done in
the PR.

std::vector<TSAction> TSContScheduleOnEntirePool(TSCont contp, TSHRTime
timeout, TSThreadPool tp)
std::vector<TSAction> TSContScheduleEveryOnEntirePool(TSCont contp,
TSHRTime every, TSThreadPool tp)

TSContScheduleOnEntirePool() is used for scheduling a continuation once, on
all the threads of thread type tp, with a possible delay specified by
timeout.
TSContScheduleEveryOnEntirePool() is used for scheduling a continuation at
an interval, on all the threads of thread type tp, the interval is
specified by every, where every != 0.


On Fri, Oct 20, 2023 at 10:59 AM Leif Hedstrom <zw...@apache.org> wrote:

> We would need something to allow for one shot calls (eg initializing some
> thread local data).
>
> — Leif
>
> > On Oct 20, 2023, at 09:11, Fei Deng <du...@apache.org> wrote:
> >
> > We should be able to make it behave like that. But the current
> > schedule_every has an assert for (t != 0).
> >
> >> On Tue, Oct 17, 2023 at 10:09 AM Leif Hedstrom <zw...@apache.org>
> wrote:
> >>
> >> I assume “every” can be zero for a one time shot on every thread of the
> >> specified type?
> >>
> >> — Leif
> >>
> >>>> On Oct 17, 2023, at 07:26, Fei Deng <fe...@yahooinc.com.invalid>
> wrote:
> >>>
> >>> tsapi::c::TSAction
> >>> tsapi::c::TSContScheduleEveryOnEntirePool(TSCont contp, TSHRTime every,
> >>> TSThreadPool tp);
> >>>
> >>> With this we can schedule a continuation on all the threads of a
> certain
> >>> type, e.g. ET_NET, ET_TASK, etc.
> >>>
> >>> Currently we have a similar capability internally, but only when
> spawning
> >>> new thread pools
> >>>
> >>> Event *EventProcessor::schedule_spawn();
> >>>
> >>> We probably should also implement a TSContScheduleEvery variant along
> >> with
> >>> it.
> >>>
> >>> --
> >>> Regards,
> >>> Fei Deng
> >>
>
>

Re: Proposed new TS API function: TSContScheduleOnEntirePool

Posted by Leif Hedstrom <zw...@apache.org>.
We would need something to allow for one shot calls (eg initializing some thread local data).

— Leif 

> On Oct 20, 2023, at 09:11, Fei Deng <du...@apache.org> wrote:
> 
> We should be able to make it behave like that. But the current
> schedule_every has an assert for (t != 0).
> 
>> On Tue, Oct 17, 2023 at 10:09 AM Leif Hedstrom <zw...@apache.org> wrote:
>> 
>> I assume “every” can be zero for a one time shot on every thread of the
>> specified type?
>> 
>> — Leif
>> 
>>>> On Oct 17, 2023, at 07:26, Fei Deng <fe...@yahooinc.com.invalid> wrote:
>>> 
>>> tsapi::c::TSAction
>>> tsapi::c::TSContScheduleEveryOnEntirePool(TSCont contp, TSHRTime every,
>>> TSThreadPool tp);
>>> 
>>> With this we can schedule a continuation on all the threads of a certain
>>> type, e.g. ET_NET, ET_TASK, etc.
>>> 
>>> Currently we have a similar capability internally, but only when spawning
>>> new thread pools
>>> 
>>> Event *EventProcessor::schedule_spawn();
>>> 
>>> We probably should also implement a TSContScheduleEvery variant along
>> with
>>> it.
>>> 
>>> --
>>> Regards,
>>> Fei Deng
>> 


Re: Proposed new TS API function: TSContScheduleOnEntirePool

Posted by Fei Deng <du...@apache.org>.
We should be able to make it behave like that. But the current
schedule_every has an assert for (t != 0).

On Tue, Oct 17, 2023 at 10:09 AM Leif Hedstrom <zw...@apache.org> wrote:

> I assume “every” can be zero for a one time shot on every thread of the
> specified type?
>
> — Leif
>
> > On Oct 17, 2023, at 07:26, Fei Deng <fe...@yahooinc.com.invalid> wrote:
> >
> > tsapi::c::TSAction
> > tsapi::c::TSContScheduleEveryOnEntirePool(TSCont contp, TSHRTime every,
> > TSThreadPool tp);
> >
> > With this we can schedule a continuation on all the threads of a certain
> > type, e.g. ET_NET, ET_TASK, etc.
> >
> > Currently we have a similar capability internally, but only when spawning
> > new thread pools
> >
> > Event *EventProcessor::schedule_spawn();
> >
> > We probably should also implement a TSContScheduleEvery variant along
> with
> > it.
> >
> > --
> > Regards,
> > Fei Deng
>

Re: Proposed new TS API function: TSContScheduleOnEntirePool

Posted by Leif Hedstrom <zw...@apache.org>.
I assume “every” can be zero for a one time shot on every thread of the specified type?

— Leif 

> On Oct 17, 2023, at 07:26, Fei Deng <fe...@yahooinc.com.invalid> wrote:
> 
> tsapi::c::TSAction
> tsapi::c::TSContScheduleEveryOnEntirePool(TSCont contp, TSHRTime every,
> TSThreadPool tp);
> 
> With this we can schedule a continuation on all the threads of a certain
> type, e.g. ET_NET, ET_TASK, etc.
> 
> Currently we have a similar capability internally, but only when spawning
> new thread pools
> 
> Event *EventProcessor::schedule_spawn();
> 
> We probably should also implement a TSContScheduleEvery variant along with
> it.
> 
> --
> Regards,
> Fei Deng