/** Software (low priority) clock interrupt.* Run periodic events from timeout queue.*/voidsoftclock(void*dummy)// softticks一直小于等于ticks while(softticks!=ticks){// 来记录时钟软中断数 softticks++;/* * softticks may be modified by hard clock, so cache * it while we work on a given bucket. */curticks=softticks;// 取出当前softticks>对应的timer链表bucket=&callwheel[curticks&callwheelmask];c=TAILQ_FIRST(bucket);while(c){if(c->c_time!=curticks){// 保持该元素在链表里,持续的检查这个链表.c=TAILQ_NEXT(c,c_links.tqe);++steps;if(steps>=MAX_SOFTCLOCK_STEPS){nextsoftcheck=c;;c=nextsoftcheck;steps=0;}// 这个timer expire了 }else{// 取下一个要判断的timernextsoftcheck=TAILQ_NEXT(c,c_links.tqe);TAILQ_REMOVE(bucket,c,c_links.tqe);// 执行相应的函数c_func(c_arg);c=nextsoftcheck;}}