开放源码实时操作系统源码.

源代码在线查看: ntimers.c

软件大小: 17394 K
上传用户: a1a1J0
关键词: 开放源码 实时操作系统 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				void
				GsAddTimer(struct GsTimer* newtimer) {
				    int i;
				    struct GsTimer* curTimer;
				    if(our_timers.numof++>0) {
					curTimer=our_timer->head;
					for(curTimer=our_timer->head;curTimer!=NULL;curTimer=curTimer->next) {
					    if(curTimer->due>newtimer->due) { /* time to file it away... */
						if(our_timer->head==curTimer) { /* put it at the beginning... */
						    newtimer->next=our_timer->head;
						    our_timer->head=newtimer;
						    return;
						} /* else put it in the middle... */
						newtimer->next=curTimer;
						prevTimer->next=newtimer;
						return;
					    }
					    prevTimer=curTimer;
					} /* else put it at the end... */
					our_timer->tail->next=newtimer;
					our_timer->tail=newtimer;
					newtimer->next=NULL;
					return;
				    } /* else... hey it's the first timer! */
				    our_timer->head=newtimer;
				    our_timer->tail=newtimer;
				    newtimer->next=NULL;    
				}
							

相关资源