@@ -595,20 +595,19 @@ rt_tick_t rt_timer_next_timeout_tick(void)
595
595
void rt_soft_timer_check (void )
596
596
{
597
597
rt_tick_t current_tick ;
598
- rt_list_t * n ;
599
598
struct rt_timer * t ;
600
599
601
600
RT_DEBUG_LOG (RT_DEBUG_TIMER , ("software timer check enter\n" ));
602
601
603
- current_tick = rt_tick_get ();
604
-
605
602
/* lock scheduler */
606
603
rt_enter_critical ();
607
604
608
- for (n = rt_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ].next ;
609
- n != & (rt_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);)
605
+ while (!rt_list_isempty (& rt_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ]))
610
606
{
611
- t = rt_list_entry (n , struct rt_timer , row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
607
+ t = rt_list_entry (rt_soft_timer_list [RT_TIMER_SKIP_LIST_LEVEL - 1 ].next ,
608
+ struct rt_timer , row [RT_TIMER_SKIP_LIST_LEVEL - 1 ]);
609
+
610
+ current_tick = rt_tick_get ();
612
611
613
612
/*
614
613
* It supposes that the new tick shall less than the half duration of
@@ -618,9 +617,6 @@ void rt_soft_timer_check(void)
618
617
{
619
618
RT_OBJECT_HOOK_CALL (rt_timer_enter_hook , (t ));
620
619
621
- /* move node to the next */
622
- n = n -> next ;
623
-
624
620
/* remove timer from timer list firstly */
625
621
_rt_timer_remove (t );
626
622
@@ -629,9 +625,6 @@ void rt_soft_timer_check(void)
629
625
/* call timeout function */
630
626
t -> timeout_func (t -> parameter );
631
627
632
- /* re-get tick */
633
- current_tick = rt_tick_get ();
634
-
635
628
RT_OBJECT_HOOK_CALL (rt_timer_exit_hook , (t ));
636
629
RT_DEBUG_LOG (RT_DEBUG_TIMER , ("current tick: %d\n" , current_tick ));
637
630
0 commit comments