mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
Kernel: Make Thread refcounted
Similar to Process, we need to make Thread refcounted. This will solve problems that will appear once we schedule threads on more than one processor. This allows us to hold onto threads without necessarily holding the scheduler lock for the entire duration.
This commit is contained in:
parent
079486ed7e
commit
838d9fa251
14 changed files with 136 additions and 90 deletions
|
@ -68,7 +68,9 @@ KResultOr<siginfo_t> Process::do_waitid(idtype_t idtype, int id, int options)
|
|||
return reap(*waitee_process);
|
||||
} else {
|
||||
// FIXME: PID/TID BUG
|
||||
auto* waitee_thread = Thread::from_tid(waitee_pid.value());
|
||||
// Make sure to hold the scheduler lock so that we operate on a consistent state
|
||||
ScopedSpinLock scheduler_lock(g_scheduler_lock);
|
||||
auto waitee_thread = Thread::from_tid(waitee_pid.value());
|
||||
if (!waitee_thread)
|
||||
return KResult(-ECHILD);
|
||||
ASSERT((options & WNOHANG) || waitee_thread->state() == Thread::State::Stopped);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue