* @brief 测试非阻塞 wait (WNOHANG) */
| 159 | * @brief 测试非阻塞 wait (WNOHANG) |
| 160 | */ |
| 161 | void slow_child_work(void* arg) { |
| 162 | uint64_t child_id = reinterpret_cast<uint64_t>(arg); |
| 163 | |
| 164 | klog::Info("SlowChild {}: starting", child_id); |
| 165 | |
| 166 | // 执行较长时间的工作 |
| 167 | for (int i = 0; i < 10; ++i) { |
| 168 | klog::Debug("SlowChild {}: working, iter={}", child_id, i); |
| 169 | (void)sys_sleep(100); |
| 170 | } |
| 171 | |
| 172 | klog::Info("SlowChild {}: exiting", child_id); |
| 173 | sys_exit(0); |
| 174 | } |
| 175 | |
| 176 | void test_wait_no_hang(void* /*arg*/) { |
| 177 | klog::Info("=== Wait NoHang Test ==="); |