From b14ff9cdd2d5e56e89c25807e2fc852d781e6f50 Mon Sep 17 00:00:00 2001 From: nnhy Date: Thu, 8 Oct 2015 12:05:06 +0000 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E6=98=AF=E9=9C=80=E8=A6=81=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=B3=BB=E7=BB=9F=E5=90=AF=E5=8A=A8=E7=9A=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8C=E5=90=A6=E5=88=99=E6=97=A0=E6=B3=95=E5=87=86?= =?UTF-8?q?=E7=A1=AE=E4=BC=B0=E8=AE=A1=EF=BC=8C=E5=AF=BC=E8=87=B4Start?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E7=9A=84Sys.Sleep=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sys.cpp | 4 +++- Sys.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Sys.cpp b/Sys.cpp index e50676e5..b469866a 100644 --- a/Sys.cpp +++ b/Sys.cpp @@ -218,6 +218,7 @@ TSys::TSys() Interrupt.Init(); #endif + Started = false; OnStart = NULL; } @@ -493,6 +494,7 @@ bool TSys::SetTaskPeriod(uint taskid, int period) void TSys::Start() { + Started = true; #if DEBUG //AddTask(ShowTime, NULL, 2000000, 2000000); #endif @@ -509,7 +511,7 @@ void TSys::Start() void TimeSleep(uint us) { // 在这段时间里面,去处理一下别的任务 - if(Sys.Clock > 0 && us != 0 && us >= 50) + if(Sys.Started && us != 0 && us >= 50) { TaskScheduler* sc = Task::Scheduler(); // 记录当前正在执行任务 diff --git a/Sys.h b/Sys.h index a421c0c2..2ed070c5 100644 --- a/Sys.h +++ b/Sys.h @@ -124,6 +124,8 @@ public: bool SetTask(uint taskid, bool enable, int msNextTime = -1); // 改变任务周期 bool SetTaskPeriod(uint taskid, int period); + + bool Started; void Start(); // 开始系统大循环 Func OnStart; };