diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-02-16 12:58:02 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-02-20 15:18:49 +0100 |
commit | 08adc0dc7f78ca24d8bbb16ebefe32c98154ac2b (patch) | |
tree | d403ea4791485038b4ccb5237771b20de101e607 /cpukit/include/rtems/rtems/modesimpl.h | |
parent | rtems: New errors for rtems_signal_catch() (diff) | |
download | rtems-08adc0dc7f78ca24d8bbb16ebefe32c98154ac2b.tar.bz2 |
rtems: Add _Modes_Apply_timeslice_to_thread()
Update #4244.
Diffstat (limited to '')
-rw-r--r-- | cpukit/include/rtems/rtems/modesimpl.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cpukit/include/rtems/rtems/modesimpl.h b/cpukit/include/rtems/rtems/modesimpl.h index 9a2c6e1013..924e12fbee 100644 --- a/cpukit/include/rtems/rtems/modesimpl.h +++ b/cpukit/include/rtems/rtems/modesimpl.h @@ -22,6 +22,7 @@ #include <rtems/score/schedulerimpl.h> #include <rtems/score/smpimpl.h> #include <rtems/score/threadimpl.h> +#include <rtems/config.h> #ifdef __cplusplus extern "C" { @@ -133,6 +134,27 @@ RTEMS_INLINE_ROUTINE bool _Modes_Is_preempt_mode_supported( } #endif +/** + * @brief Applies the timeslice mode to the thread. + * + * @param mode_set is the mode set which specifies the timeslice mode for the + * thread. + * + * @param[out] the_thread is the thread to apply the timeslice mode. + */ +RTEMS_INLINE_ROUTINE void _Modes_Apply_timeslice_to_thread( + rtems_mode mode_set, + Thread_Control *the_thread +) +{ + if ( _Modes_Is_timeslice( mode_set ) ) { + the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; + the_thread->cpu_time_budget = rtems_configuration_get_ticks_per_timeslice(); + } else { + the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; + } +} + #ifdef __cplusplus } #endif |