* @brief 子进程工作函数 */
| 30 | * @brief 子进程工作函数 |
| 31 | */ |
| 32 | void child_work(void* arg) { |
| 33 | uint64_t child_id = reinterpret_cast<uint64_t>(arg); |
| 34 | int exit_code = static_cast<int>(child_id); |
| 35 | |
| 36 | klog::Info("Child {}: starting, will exit with code {}", child_id, exit_code); |
| 37 | |
| 38 | // 执行一些工作 |
| 39 | for (int i = 0; i < 5; ++i) { |
| 40 | klog::Debug("Child {}: working, iter={}", child_id, i); |
| 41 | (void)sys_sleep(30); |
| 42 | } |
| 43 | |
| 44 | klog::Info("Child {}: exiting with code {}", child_id, exit_code); |
| 45 | sys_exit(exit_code); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * @brief 测试基本的 wait 功能 |