例子:FreeRTOS
A FreeRTOS application will start up and execute just like a non-RTOS application until vTaskStartScheduler() is called.
BaseType_t xTaskCreate(
TaskFunction_t pvTaskCode,
const char * const pcName,
const configSTACK_DEPTH_TYPE uxStackDepth,
void *pvParameters,
UBaseType_t uxPriority,
TaskHandle_t *pxCreatedTask);
- (和 thread.h 里的 spawn 差不多)
- Task 是死循环
- 操作系统按优先级唤醒 block 的 tasks (高优先级抢占)
- 没有 hard real-time; 但优先级能实现控制