kernel/sys_clock.c
/*
 * Always called from interrupt level, and always only from the system clock
 * interrupt, thus:
 * - _current does not have to be protected, since it only changes at thread
 *   level or when exiting a non-nested interrupt
 * - _time_slice_elapsed does not have to be protected, since it can only change
 *   in this function and at thread level
 * - _time_slice_duration does not have to be protected, since it can only
 *   change at thread level
 */
Always called from interrupt level, and always only from the system clock
interrupt, thus:
- _current does not have to be protected, since it only changes at thread
level or when exiting a non-nested interrupt
- _time_slice_elapsed does not have to be protected, since it can only change
in this function and at thread level
- _time_slice_duration does not have to be protected, since it can only
change at thread level
Always called from interrupt level and always only from the system clock interrupt thus : - _current does not have to be protected since it only changes at thread level or when exiting a non - nested interrupt - _time_slice_elapsed does not have to be protected since it can only change in this function and at thread level - _time_slice_duration does not have to be protected since it can only change at thread level
static void handle_time_slicing(s32_t ticks)
{
#ifdef CONFIG_TICKLESS_KERNEL
	next_ts = 0;
	if (!_is_thread_time_slicing(_current)) {
		return;
	}
#else
	if (_time_slice_duration == 0) {
		return;
	}
	if (_is_prio_higher(_current->base.prio, _time_slice_prio_ceiling)) {
		return;
	}
#endif
	_time_slice_elapsed += __ticks_to_ms(ticks);
	if (_time_slice_elapsed >= _time_slice_duration) {
		unsigned int key;
		_time_slice_elapsed = 0;
		key = irq_lock();
		_move_thread_to_end_of_prio_q(_current);
		irq_unlock(key);
	}
#ifdef CONFIG_TICKLESS_KERNEL
	next_ts =
	    _ms_to_ticks(_time_slice_duration - _time_slice_elapsed);
#endif
}
static void handle_time_slicing ( s32_t ticks ) { #ifdef CONFIG_TICKLESS_KERNEL next_ts = 0 ; if ( ! _is_thread_time_slicing ( _current ) ) { return ; } #else if ( _time_slice_duration == 0 ) { return ; } if ( _is_prio_higher ( _current -> base . prio , _time_slice_prio_ceiling ) ) { return ; } #endif _time_slice_elapsed += __ticks_to_ms ( ticks ) ; if ( _time_slice_elapsed >= _time_slice_duration ) { unsigned int key ; _time_slice_elapsed = 0 ; key = irq_lock ( ) ; _move_thread_to_end_of_prio_q ( _current ) ; irq_unlock ( key ) ; } #ifdef CONFIG_TICKLESS_KERNEL next_ts = _ms_to_ticks ( _time_slice_duration - _time_slice_elapsed ) ; #endif }
Always called from interrupt level, and always only from the system clock
 interrupt, thus:
 - _current does not have to be protected, since it only changes at thread
   level or when exiting a non-nested interrupt
 - _time_slice_elapsed does not have to be protected, since it can only change
   in this function and at thread level
 - _time_slice_duration does not have to be protected, since it can only
   change at thread level
Always called from interrupt level and always only from the system clock interrupt thus : - _current does not have to be protected since it only changes at thread level or when exiting a non - nested interrupt - _time_slice_elapsed does not have to be protected since it can only change in this function and at thread level - _time_slice_duration does not have to be protected since it can only change at thread level