| 95 | } |
| 96 | |
| 97 | void mid_parent_work(void* /*arg*/) { |
| 98 | auto& tm = TaskManagerSingleton::instance(); |
| 99 | auto* self = tm.GetCurrentTask(); |
| 100 | g_mid_parent_pid.store(self->pid); |
| 101 | |
| 102 | // Spawn grandchild |
| 103 | auto gc = kstd::make_unique<TaskControlBlock>("Grandchild", 10, |
| 104 | grandchild_work, nullptr); |
| 105 | gc->aux->parent_pid = self->pid; |
| 106 | tm.AddTask(std::move(gc)); |
| 107 | |
| 108 | klog::Info("mid_parent_work: spawned grandchild, exiting quickly"); |
| 109 | // Exit quickly so grandchild becomes orphan and gets reparented |
| 110 | (void)sys_sleep(50); |
| 111 | sys_exit(0); |
| 112 | } |
| 113 | |
| 114 | void test_orphan_reparent(void* /*arg*/) { |
| 115 | klog::Info("=== Orphan Reparent Test ==="); |
nothing calls this directly
no test coverage detected