mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
da0b7d1737
The PCSpeaker is global and not locked anyways, so there's no need for mutual exclusion between threads in the same process.
24 lines
495 B
C++
24 lines
495 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/Devices/PCSpeaker.h>
|
|
#include <Kernel/Process.h>
|
|
|
|
namespace Kernel {
|
|
|
|
KResultOr<FlatPtr> Process::sys$beep()
|
|
{
|
|
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
|
PCSpeaker::tone_on(440);
|
|
auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000));
|
|
PCSpeaker::tone_off();
|
|
if (result.was_interrupted())
|
|
return EINTR;
|
|
return 0;
|
|
}
|
|
|
|
}
|