mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 14:07:42 +00:00
Kernel: Move PC speaker beep timing logic from scheduler to the syscall
I don't know why I put this in the scheduler to begin with.. the caller can just block until the beeping is finished.
This commit is contained in:
parent
154d10e4e9
commit
95034fdfbd
2 changed files with 6 additions and 14 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <Kernel/Console.h>
|
#include <Kernel/Console.h>
|
||||||
#include <Kernel/Devices/KeyboardDevice.h>
|
#include <Kernel/Devices/KeyboardDevice.h>
|
||||||
#include <Kernel/Devices/NullDevice.h>
|
#include <Kernel/Devices/NullDevice.h>
|
||||||
|
#include <Kernel/Devices/PCSpeaker.h>
|
||||||
#include <Kernel/Devices/RandomDevice.h>
|
#include <Kernel/Devices/RandomDevice.h>
|
||||||
#include <Kernel/FileSystem/Custody.h>
|
#include <Kernel/FileSystem/Custody.h>
|
||||||
#include <Kernel/FileSystem/DevPtsFS.h>
|
#include <Kernel/FileSystem/DevPtsFS.h>
|
||||||
|
@ -3623,7 +3624,11 @@ int Process::sys$yield()
|
||||||
|
|
||||||
int Process::sys$beep()
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include <AK/TemporaryChange.h>
|
#include <AK/TemporaryChange.h>
|
||||||
#include <Kernel/Arch/i386/PIT.h>
|
#include <Kernel/Arch/i386/PIT.h>
|
||||||
#include <Kernel/Devices/PCSpeaker.h>
|
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/Profiling.h>
|
#include <Kernel/Profiling.h>
|
||||||
|
@ -51,7 +50,6 @@ Thread* g_colonel;
|
||||||
WaitQueue* g_finalizer_wait_queue;
|
WaitQueue* g_finalizer_wait_queue;
|
||||||
static Process* s_colonel_process;
|
static Process* s_colonel_process;
|
||||||
u64 g_uptime;
|
u64 g_uptime;
|
||||||
static u64 s_beep_timeout;
|
|
||||||
|
|
||||||
struct TaskRedirectionData {
|
struct TaskRedirectionData {
|
||||||
u16 selector;
|
u16 selector;
|
||||||
|
@ -65,12 +63,6 @@ bool Scheduler::is_active()
|
||||||
return s_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)
|
Thread::JoinBlocker::JoinBlocker(Thread& joinee, void*& joinee_exit_value)
|
||||||
: m_joinee(joinee)
|
: m_joinee(joinee)
|
||||||
, m_joinee_exit_value(joinee_exit_value)
|
, 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;
|
tv.tv_usec = PIT::ticks_this_second() * 1000;
|
||||||
Process::update_info_page_timestamp(tv);
|
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()) {
|
if (current->process().is_profiling()) {
|
||||||
auto backtrace = current->raw_backtrace(regs.ebp);
|
auto backtrace = current->raw_backtrace(regs.ebp);
|
||||||
auto& sample = Profiling::next_sample_slot();
|
auto& sample = Profiling::next_sample_slot();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue