| 228 | } |
| 229 | |
| 230 | void KProcess::deleteThread(KThread* thread) { |
| 231 | thread->cleanup(); |
| 232 | if (this->threads.size() == 0) { |
| 233 | cleanupProcess(); |
| 234 | delete this->memory; // this might call KThread::currentThread, so don't delete thread before this |
| 235 | this->memory = nullptr; |
| 236 | } |
| 237 | delete thread; |
| 238 | // don't call into getProcess while holding threadsCondition |
| 239 | if (!this->terminated && this->getThreadCount() == 0) { |
| 240 | KProcessPtr parent = KSystem::getProcess(this->parentId); |
| 241 | if (!parent || parent->getThreadCount() == 0) { |
| 242 | KSystem::eraseProcess(this->id); |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | FsOpenNode* openCommandLine(const std::shared_ptr<FsNode>& node, U32 flags, U32 data) { |
| 248 | return new BufferAccess(node, flags, KThread::currentThread()->process->commandLine); |