thread

代码示例


class TestThread{
pubilc:
    TestThread(){
        auto thread_fn = [](TestThread* test){
            while(true){
                test->thread_.Sleep(1);
            }
        };

        this->thread_.Create(thread_fn, this, "init_thread_fn", 512, System::Thread::REALTIME)
    }

    System::Thread thread_;
};

API

/**
 * @brief 创建任务
 *
 * @param fn 任务函数
 * @param arg 任务函数参数
 * @param name 任务名称
 * @param stack_depth 堆栈大小
 * @param priority 优先级
 */
System::Thread::Create(FunType fn, ArgType arg, const char* name, uint32_t stack_depth, Priority priority)
/**
 * @brief 延时
 *
 * @param microseconds 毫秒数
 */
System::Thread::Sleep(uint32_t microseconds)
/**
 * @brief 精确延时
 *
 * @param microseconds 毫秒数
 */
System::Thread::SleepUntil(uint32_t microseconds)