mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
Kernel: Guard the all processes list with a Spinlock rather than a Mutex
There are callers of processes().with or processes().for_each that require interrupts to be disabled. Taking a Mutexe with interrupts disabled is a recipe for deadlock, so convert this to a Spinlock.
This commit is contained in:
parent
70518e69f4
commit
dea62fe93c
4 changed files with 13 additions and 13 deletions
|
@ -815,13 +815,13 @@ static_assert(sizeof(Process) == (PAGE_SIZE * 2));
|
|||
|
||||
extern RecursiveSpinlock g_profiling_lock;
|
||||
|
||||
MutexProtected<Process::List>& processes();
|
||||
SpinlockProtected<Process::List>& processes();
|
||||
|
||||
template<IteratorFunction<Process&> Callback>
|
||||
inline void Process::for_each(Callback callback)
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
processes().with_shared([&](const auto& list) {
|
||||
processes().with([&](const auto& list) {
|
||||
for (auto it = list.begin(); it != list.end();) {
|
||||
auto& process = *it;
|
||||
++it;
|
||||
|
@ -835,7 +835,7 @@ template<IteratorFunction<Process&> Callback>
|
|||
inline void Process::for_each_child(Callback callback)
|
||||
{
|
||||
ProcessID my_pid = pid();
|
||||
processes().with_shared([&](const auto& list) {
|
||||
processes().with([&](const auto& list) {
|
||||
for (auto it = list.begin(); it != list.end();) {
|
||||
auto& process = *it;
|
||||
++it;
|
||||
|
@ -876,7 +876,7 @@ inline IterationDecision Process::for_each_thread(Callback callback)
|
|||
template<IteratorFunction<Process&> Callback>
|
||||
inline void Process::for_each_in_pgrp(ProcessGroupID pgid, Callback callback)
|
||||
{
|
||||
processes().with_shared([&](const auto& list) {
|
||||
processes().with([&](const auto& list) {
|
||||
for (auto it = list.begin(); it != list.end();) {
|
||||
auto& process = *it;
|
||||
++it;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue