MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / mid_parent_work

Function mid_parent_work

tests/system_test/zombie_reap_test.cpp:97–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void 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
114void test_orphan_reparent(void* /*arg*/) {
115 klog::Info("=== Orphan Reparent Test ===");

Callers

nothing calls this directly

Calls 5

InfoFunction · 0.85
sys_sleepFunction · 0.85
sys_exitFunction · 0.85
GetCurrentTaskMethod · 0.80
AddTaskMethod · 0.80

Tested by

no test coverage detected