A method of using a timer interrupt timeout task, first establish task execution management system; application to add the task to the task management system, and specifies the maximum allowed execution time; task management system record the current time, and according to the maximum execution time, the calculation should be the end of the time; task management system check whether the timer is started, if not already running, it will start; start the task management system; regularly check whether each task timer is overtime, if overtime, stops the execution of tasks; if there is a running task, the management system of the inspection results did not stop the execution, the timer. The present invention enables the use of timers to interrupt task execution in real time when performing relatively time-consuming tasks.
【技术实现步骤摘要】
本专利技术涉及,特别涉及一种采用在执 行比较耗时的任务时,能够使用计时器来实时中断任务执行的方法。
技术介绍
执行比较耗时的任务时,通常需要随时中断任务的执行。本专利技术将使用计时器的方式来为任务的执行计时,到达规定时间如果没有 未执行完毕,则停止任务的执行。
技术实现思路
本专利技术所要解决的技术问题是提供一种采用在执行比较耗时的任务时,能 够使用计时器来实时中断任务执行的方法。本专利技术所述的 ,该方法至少包括如下的步骤步骤l:建立任务执行管理系统。步骤2:应用程序将任务添加到该任务管理系统中,同时指定最大允许执行 时间。步骤3:任务管理系统记下当前的时间,并4艮据最大允许l丸行的时间,计算 应该^^结的时间。步骤4:任务管理系统检查计时器是否已经开始运行,如果尚未运行,则将 其启动。步骤5:任务管理系统启动该任务。步骤6:计时器定期检查每个任务是否已经超时,如果超时,则停止该任务的执行。步骤7:管理系统检查是否还有正在运行的任务,结果没有,则停止计时器 的执行。本专利技术所述的 ,建立任务执行管理系统,其步骤为步骤ll:支持随时将任务添加到该管理系统中。 ...
【技术保护点】
一种使用计时器来中断超时任务的方法,其特征在于:该方法至少包括如下的步骤: 步骤1:建立任务执行管理系统。 步骤2:应用程序将任务添加到该任务管理系统中,同时指定最大允许执行时间。 步骤3:任务管理系统记下当前的时间,并根 据最大允许执行的时间,计算应该终结的时间。 步骤4:任务管理系统检查计时器是否已经开始运行,如果尚未运行,则将其启动。 步骤5:任务管理系统启动该任务。 步骤6:计时器定期检查每个任务是否已经超时,如果超时,则停止该任务的 执行。 步骤7:管理系统检查是否还有正在运行的任务,结果没有,则停止计时器的执行。
【技术特征摘要】
1、一种使用计时器来中断超时任务的方法,其特征在于该方法至少包括如下的步骤步骤1建立任务执行管理系统。步骤2应用程序将任务添加到该任务管理系统中,同时指定最大允许执行时间。步骤3任务管理系统记下当前的时间,并根据最大允许执行的时间,计算应该终结的时间。步骤4任务管理系统检查计时器是否已经开始运行,如果尚未运行,则将其启动。步骤5任务管理系统启动该任务。步骤6计时器定期检查每个任务是...
【专利技术属性】
技术研发人员:汤海京,徐友春,朱红军,刘莹,赵峰,
申请(专利权)人:北京闻言科技有限公司,
类型:发明
国别省市:11[中国|北京]
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。