openLuat / LuatOS

LuatOS -- Powerful embedded Lua Engine for IoT devices, with many components and low memory requirements (16K RAM, 128K Flash)
https://wiki.luatos.com
MIT License
452 stars 102 forks source link

air202 sys.taskinit #67

Closed MadDogMayCry0 closed 2 years ago

MadDogMayCry0 commented 2 years ago
local function one()
    -- you have to use sys.wait... or its will newer be runned
        sys.wait(1000)
    while true do end
end
sys.taskInit(one)
sys.init(0, 0)

So, if you did'nt use sys.wait(1) inside of while true .. sys.wait(1) .. do module going to restart after 30 sec of works. It's becuse module has only one true core, and can't runing a code in a async mode. So, be careful with understanding on what task is :)