From 6d44e64dd5e021635457e8ee886a456348019e8d Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 21 Sep 2023 19:51:07 +0800 Subject: [PATCH] fix some bug --- os/zos_schduler.cpp | 1 - os/zos_schduler.hpp | 4 ++-- os/zos_thread.hpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/os/zos_schduler.cpp b/os/zos_schduler.cpp index 1ab5eaa..e799b78 100644 --- a/os/zos_schduler.cpp +++ b/os/zos_schduler.cpp @@ -11,7 +11,6 @@ void ZOSSchduler::regPeriodJob(function job, uint32_t pe } void ZOSSchduler::loop() { - static uint32_t ticket = 0; Context context; if (zos_haspassedms(ticket) < 1) { return; diff --git a/os/zos_schduler.hpp b/os/zos_schduler.hpp index a66a457..afbe3f3 100644 --- a/os/zos_schduler.hpp +++ b/os/zos_schduler.hpp @@ -48,6 +48,7 @@ class ZOSSchduler { *******************************************************************************/ list m_periodJobs; ZOSThread m_thread; + uint32_t ticket = 0; public: ZOSSchduler() {} @@ -57,9 +58,8 @@ class ZOSSchduler { void regPeriodJob(function job, uint32_t period_ms); void startSchedule(const char* threadname, int stack_size, osPriority priority); - private: + private: void loop(); - }; // #define ZHAL_CORE_REG(period_ms, job) ZOSSchduler::getInstance()->regPeriodJob([this](ZOSSchduler::Context& context) { job }, period_ms); diff --git a/os/zos_thread.hpp b/os/zos_thread.hpp index 63ccbcb..37617ed 100644 --- a/os/zos_thread.hpp +++ b/os/zos_thread.hpp @@ -10,7 +10,7 @@ class ZOSThread { const char* _threadname; public: - void init(const char* threadname, int stack_size = 512, osPriority priority = osPriorityNormal); + void init(const char* threadname, int stack_size = 1024,osPriority priority = osPriorityNormal); void run(function func); public: