rem: lock( timer_list->mutex ); for( tl=timer_list->first_tl ; tl && tl->time_out<new_tl->time_out ; tl=tl->next_tl ); if ( tl ) {  new_tl->prev_tl = tl->prev_tl; tl->prev_tl = new_tl; } else {  new_tl->prev_tl = timer_list->last_tl; new_tl->next_tl = NULL; timer_list->last_tl = new_tl; } if (new_tl->prev_tl ) new_tl->prev_tl->next_tl = new_tl; else timer_list->first_tl = new_tl; new_tl->next_tl = new_tl; unlock( timer_list->mutex );
add: unlock( timer_list->mutex );
context: void insert_into_timer_list( struct s_table* hash_table , struct timer_link* new_tl, int list_id , unsigned int time_out ){   struct timer          *timer_list = &(hash_table->timers[ list_id ]);   struct timer_link  *tl;   new_tl->time_out = time_out ;   DBG("DEBUG: insert_into_timer[%d]: %d, %p\n",list_id,new_tl->time_out,new_tl);       lock( timer_list->mutex );       for( tl=timer_list->first_tl ; tl && tl->time_out<new_tl->time_out ;                tl=tl->next_tl );       if ( tl ) {               /* insert before tl*/               new_tl->prev_tl = tl->prev_tl;               tl->prev_tl = new_tl;       } else { /* at the end or empty list */               new_tl->prev_tl = timer_list->last_tl;               new_tl->next_tl = NULL;               timer_list->last_tl = new_tl;       }       if (new_tl->prev_tl )                new_tl->prev_tl->next_tl = new_tl;       else               timer_list->first_tl = new_tl;       new_tl->next_tl = new_tl;       unlock( timer_list->mutex );}