mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-22 05:55:12 +08:00
@@ -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
|
||||
|
||||
@@ -27,7 +27,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,
|
||||
@@ -98,13 +97,8 @@ rtems_status_code rtems_task_mode(
|
||||
executing->is_preemptible = is_preempt_enabled;
|
||||
}
|
||||
|
||||
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;
|
||||
if ( ( mask & RTEMS_TIMESLICE_MASK ) != 0 ) {
|
||||
_Modes_Apply_timeslice_to_thread( mode_set, executing );
|
||||
}
|
||||
|
||||
if ( ( mask & RTEMS_INTERRUPT_MASK ) != 0 ) {
|
||||
|
||||
Reference in New Issue
Block a user