mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 01:18:12 +00:00
Kernel: Remove old block(State) API
New API should be used always :)
This commit is contained in:
parent
762333ba95
commit
99c5377653
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)
|
void Thread::block_until(const char* state_string, Function<bool()>&& condition)
|
||||||
{
|
{
|
||||||
m_blocker = make<ConditionBlocker>(state_string, condition);
|
m_blocker = make<ConditionBlocker>(state_string, condition);
|
||||||
block(Thread::Blocked);
|
block_helper();
|
||||||
Scheduler::yield();
|
Scheduler::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::block(Thread::State new_state)
|
void Thread::block_helper()
|
||||||
{
|
{
|
||||||
bool did_unlock = process().big_lock().unlock_if_locked();
|
bool did_unlock = process().big_lock().unlock_if_locked();
|
||||||
ASSERT(state() == Thread::Running);
|
ASSERT(state() == Thread::Running);
|
||||||
m_was_interrupted_while_blocked = false;
|
m_was_interrupted_while_blocked = false;
|
||||||
set_state(new_state);
|
set_state(Thread::Blocked);
|
||||||
Scheduler::yield();
|
Scheduler::yield();
|
||||||
if (did_unlock)
|
if (did_unlock)
|
||||||
process().big_lock().lock();
|
process().big_lock().lock();
|
||||||
|
@ -129,7 +129,7 @@ void Thread::block(Thread::State new_state)
|
||||||
void Thread::block(Blocker& blocker)
|
void Thread::block(Blocker& blocker)
|
||||||
{
|
{
|
||||||
m_blocker = &blocker;
|
m_blocker = &blocker;
|
||||||
block(Thread::Blocked);
|
block_helper();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 Thread::sleep(u32 ticks)
|
u64 Thread::sleep(u32 ticks)
|
||||||
|
|
|
@ -208,7 +208,6 @@ public:
|
||||||
u32 ticks() const { return m_ticks; }
|
u32 ticks() const { return m_ticks; }
|
||||||
|
|
||||||
u64 sleep(u32 ticks);
|
u64 sleep(u32 ticks);
|
||||||
void block(Thread::State);
|
|
||||||
void block(Blocker& blocker);
|
void block(Blocker& blocker);
|
||||||
void unblock();
|
void unblock();
|
||||||
|
|
||||||
|
@ -299,6 +298,8 @@ private:
|
||||||
State m_state { Invalid };
|
State m_state { Invalid };
|
||||||
bool m_has_used_fpu { false };
|
bool m_has_used_fpu { false };
|
||||||
bool m_was_interrupted_while_blocked { false };
|
bool m_was_interrupted_while_blocked { false };
|
||||||
|
|
||||||
|
void block_helper();
|
||||||
};
|
};
|
||||||
|
|
||||||
HashTable<Thread*>& thread_table();
|
HashTable<Thread*>& thread_table();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue