put a new linker into a timer_list */
| 797 | |
| 798 | /* put a new linker into a timer_list */ |
| 799 | static void insert_timer_unsafe( struct timer *timer_list, |
| 800 | struct timer_link *tl, utime_t time_out ) |
| 801 | { |
| 802 | struct timer_link* ptr; |
| 803 | |
| 804 | tl->time_out = time_out; |
| 805 | tl->timer_list = timer_list; |
| 806 | tl->deleted = 0; |
| 807 | |
| 808 | #ifdef TM_TIMER_DEBUG |
| 809 | check_timer_list( timer_list, "before insert" ); |
| 810 | #endif |
| 811 | ptr = timer_list->last_tl.prev_tl; |
| 812 | for( ; ptr != &timer_list->first_tl ; ptr = ptr->ld_tl->prev_tl) { |
| 813 | if ( ptr->time_out<=time_out ) |
| 814 | break; |
| 815 | } |
| 816 | |
| 817 | /* insert "tl" after "ptr" */ |
| 818 | tl->prev_tl = ptr; |
| 819 | tl->next_tl = ptr->next_tl; |
| 820 | tl->prev_tl->next_tl = tl; |
| 821 | tl->next_tl->prev_tl = tl; |
| 822 | |
| 823 | if (tl->time_out==ptr->time_out) { |
| 824 | tl->ld_tl = ptr->ld_tl; |
| 825 | ptr->ld_tl = 0; |
| 826 | tl->ld_tl->ld_tl = tl; |
| 827 | } else { |
| 828 | tl->ld_tl = tl; |
| 829 | } |
| 830 | #ifdef TM_TIMER_DEBUG |
| 831 | check_timer_list( timer_list, "after insert" ); |
| 832 | #endif |
| 833 | |
| 834 | LM_DBG("[%d]: %p (%lld)\n",timer_list->id, |
| 835 | tl,tl->time_out); |
| 836 | } |
| 837 | |
| 838 | |
| 839 |
no test coverage detected