diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index cbc825c9e4..34aa556800 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -3623,7 +3624,11 @@ int Process::sys$yield() int Process::sys$beep() { - Scheduler::beep(); + PCSpeaker::tone_on(440); + u64 wakeup_time = current->sleep(100); + PCSpeaker::tone_off(); + if (wakeup_time > g_uptime) + return -EINTR; return 0; } diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 99a2ccd920..e90960f5a2 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -51,7 +50,6 @@ Thread* g_colonel; WaitQueue* g_finalizer_wait_queue; static Process* s_colonel_process; u64 g_uptime; -static u64 s_beep_timeout; struct TaskRedirectionData { u16 selector; @@ -65,12 +63,6 @@ bool Scheduler::is_active() return s_active; } -void Scheduler::beep() -{ - PCSpeaker::tone_on(440); - s_beep_timeout = g_uptime + 100; -} - Thread::JoinBlocker::JoinBlocker(Thread& joinee, void*& joinee_exit_value) : m_joinee(joinee) , m_joinee_exit_value(joinee_exit_value) @@ -554,11 +546,6 @@ void Scheduler::timer_tick(RegisterDump& regs) tv.tv_usec = PIT::ticks_this_second() * 1000; Process::update_info_page_timestamp(tv); - if (s_beep_timeout && g_uptime > s_beep_timeout) { - PCSpeaker::tone_off(); - s_beep_timeout = 0; - } - if (current->process().is_profiling()) { auto backtrace = current->raw_backtrace(regs.ebp); auto& sample = Profiling::next_sample_slot();