On Wed, Feb 17, 2021 at 12:31 PM Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote: > > Update #4244. > --- > cpukit/include/rtems/rtems/modesimpl.h | 15 +++++++++++++++ > cpukit/rtems/src/taskmode.c | 8 +------- > 2 files changed, 16 insertions(+), 7 deletions(-) > > diff --git a/cpukit/include/rtems/rtems/modesimpl.h > b/cpukit/include/rtems/rtems/modesimpl.h > index 5677c7f13d..f6711b4c2d 100644 > --- a/cpukit/include/rtems/rtems/modesimpl.h > +++ b/cpukit/include/rtems/rtems/modesimpl.h > @@ -20,6 +20,8 @@ > > #include <rtems/rtems/modes.h> > #include <rtems/score/isrlevel.h> > +#include <rtems/score/thread.h> > +#include <rtems/config.h> > > #ifdef __cplusplus > extern "C" { > @@ -99,6 +101,19 @@ RTEMS_INLINE_ROUTINE void _Modes_Set_interrupt_level ( > _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) ); > } > > +RTEMS_INLINE_ROUTINE void _Modes_Set_timeslice( I don't really like the name. It implies we want to set timeslicing true.
_Modes_Update_timeslice() may be better? I just want to avoid that Get/Set implication. > + Thread_Control *executing, > + rtems_mode mode_set > +) > +{ > + if ( _Modes_Is_timeslice( mode_set ) ) { > + executing->budget_algorithm = > THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; > + executing->cpu_time_budget = > rtems_configuration_get_ticks_per_timeslice(); > + } else { > + executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; > + } > +} > + > #ifdef __cplusplus > } > #endif > diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c > index 24905368c3..197f5e1556 100644 > --- a/cpukit/rtems/src/taskmode.c > +++ b/cpukit/rtems/src/taskmode.c > @@ -26,7 +26,6 @@ > #include <rtems/score/schedulerimpl.h> > #include <rtems/score/smpimpl.h> > #include <rtems/score/threadimpl.h> > -#include <rtems/config.h> > > rtems_status_code rtems_task_mode( > rtems_mode mode_set, > @@ -104,12 +103,7 @@ rtems_status_code rtems_task_mode( > } > > if ( mask & RTEMS_TIMESLICE_MASK ) { > - if ( _Modes_Is_timeslice(mode_set) ) { > - executing->budget_algorithm = > THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; > - executing->cpu_time_budget = > - rtems_configuration_get_ticks_per_timeslice(); > - } else > - executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; > + _Modes_Set_timeslice( executing, mode_set ); Like here, I would assume this is going to set the timeslice/budget. It is just a little unclear. > } > > /* > -- > 2.26.2 > > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel