mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
Kernel: Remove old block(State) API
New API should be used always :)
This commit is contained in:
parent
762333ba95
commit
99c5377653
Notes:
sideshowbarker
2024-07-19 13:09:19 +09:00
Author: https://github.com/rburchell Commit: https://github.com/SerenityOS/serenity/commit/99c53776530 Pull-request: https://github.com/SerenityOS/serenity/pull/340
2 changed files with 6 additions and 5 deletions
|
@ -111,16 +111,16 @@ void Thread::unblock()
|
|||
void Thread::block_until(const char* state_string, Function<bool()>&& condition)
|
||||
{
|
||||
m_blocker = make<ConditionBlocker>(state_string, condition);
|
||||
block(Thread::Blocked);
|
||||
block_helper();
|
||||
Scheduler::yield();
|
||||
}
|
||||
|
||||
void Thread::block(Thread::State new_state)
|
||||
void Thread::block_helper()
|
||||
{
|
||||
bool did_unlock = process().big_lock().unlock_if_locked();
|
||||
ASSERT(state() == Thread::Running);
|
||||
m_was_interrupted_while_blocked = false;
|
||||
set_state(new_state);
|
||||
set_state(Thread::Blocked);
|
||||
Scheduler::yield();
|
||||
if (did_unlock)
|
||||
process().big_lock().lock();
|
||||
|
@ -129,7 +129,7 @@ void Thread::block(Thread::State new_state)
|
|||
void Thread::block(Blocker& blocker)
|
||||
{
|
||||
m_blocker = &blocker;
|
||||
block(Thread::Blocked);
|
||||
block_helper();
|
||||
}
|
||||
|
||||
u64 Thread::sleep(u32 ticks)
|
||||
|
|
|
@ -208,7 +208,6 @@ public:
|
|||
u32 ticks() const { return m_ticks; }
|
||||
|
||||
u64 sleep(u32 ticks);
|
||||
void block(Thread::State);
|
||||
void block(Blocker& blocker);
|
||||
void unblock();
|
||||
|
||||
|
@ -299,6 +298,8 @@ private:
|
|||
State m_state { Invalid };
|
||||
bool m_has_used_fpu { false };
|
||||
bool m_was_interrupted_while_blocked { false };
|
||||
|
||||
void block_helper();
|
||||
};
|
||||
|
||||
HashTable<Thread*>& thread_table();
|
||||
|
|
Loading…
Reference in a new issue