Kernel: remove Semaphore::is_blocked

this will not mean anything after semaphores can spuriously wake up
This commit is contained in:
Bananymous 2023-07-24 22:23:13 +03:00
parent f5f4bf58ad
commit cc8af25d73
3 changed files with 1 additions and 15 deletions

View File

@ -8,15 +8,6 @@ namespace Kernel
public: public:
void block(); void block();
void unblock(); void unblock();
bool is_blocked() const { return m_blocked; }
private:
void set_blocked(bool blocked) { m_blocked = blocked; }
private:
bool m_blocked { false };
friend class Scheduler;
}; };
} }

View File

@ -327,15 +327,13 @@ namespace Kernel
static_assert(sizeof(ActiveThread) == sizeof(BlockingThread)); static_assert(sizeof(ActiveThread) == sizeof(BlockingThread));
MUST(m_blocking_threads.emplace_back(blocking, semaphore)); MUST(m_blocking_threads.emplace_back(blocking, semaphore));
semaphore->m_blocked = true;
execute_current_thread(); execute_current_thread();
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
void Scheduler::unblock_threads(Semaphore* semaphore) void Scheduler::unblock_threads(Semaphore* semaphore)
{ {
Kernel::CriticalScope critical; CriticalScope critical;
for (auto it = m_blocking_threads.begin(); it != m_blocking_threads.end();) for (auto it = m_blocking_threads.begin(); it != m_blocking_threads.end();)
{ {
@ -354,7 +352,6 @@ namespace Kernel
} }
} }
semaphore->m_blocked = false;
} }
} }

View File

@ -11,8 +11,6 @@ namespace Kernel
void Semaphore::unblock() void Semaphore::unblock()
{ {
if (!m_blocked)
return;
Scheduler::get().unblock_threads(this); Scheduler::get().unblock_threads(this);
} }