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

Method ~TaskControlBlock

src/task/task_control_block.cpp:192–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192TaskControlBlock::~TaskControlBlock() {
193 // 从线程组中移除
194 LeaveThreadGroup();
195
196 // 释放内核栈
197 if (kernel_stack) {
198 aligned_free(kernel_stack);
199 kernel_stack = nullptr;
200 }
201
202 // 释放页表(如果有用户空间页表)
203 if (page_table) {
204 // 如果是私有页表(非共享),需要释放物理页
205 auto should_free_pages = !(aux->clone_flags & clone_flag::kVm);
206 VirtualMemorySingleton::instance().DestroyPageDirectory(page_table,
207 should_free_pages);
208 page_table = nullptr;
209 }
210
211 // 释放辅助数据
212 if (aux) {
213 delete aux;
214 aux = nullptr;
215 }
216}

Callers

nothing calls this directly

Calls 2

DestroyPageDirectoryMethod · 0.80
aligned_freeFunction · 0.50

Tested by

no test coverage detected