* @brief 线程函数,增加计数器 */
| 32 | * @brief 线程函数,增加计数器 |
| 33 | */ |
| 34 | void thread_increment(void* arg) { |
| 35 | uint64_t thread_id = reinterpret_cast<uint64_t>(arg); |
| 36 | |
| 37 | for (int i = 0; i < 10; ++i) { |
| 38 | g_thread_counter++; |
| 39 | klog::Debug("Thread {}: counter={}, iter={}", thread_id, |
| 40 | g_thread_counter.load(), i); |
| 41 | (void)sys_sleep(10); |
| 42 | } |
| 43 | |
| 44 | g_thread_completed++; |
| 45 | klog::Info("Thread {}: completed", thread_id); |
| 46 | sys_exit(0); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @brief 测试线程组的基本功能 |