mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Use TRY() in sys$alarm()
This commit is contained in:
parent
b083b165a7
commit
e3b063581e
Notes:
sideshowbarker
2024-07-18 04:37:21 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e3b063581ed
1 changed files with 1 additions and 3 deletions
|
@ -30,9 +30,7 @@ KResultOr<FlatPtr> Process::sys$alarm(unsigned seconds)
|
|||
auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME_COARSE);
|
||||
deadline = deadline + Time::from_seconds(seconds);
|
||||
if (!m_alarm_timer) {
|
||||
m_alarm_timer = adopt_ref_if_nonnull(new (nothrow) Timer());
|
||||
if (!m_alarm_timer)
|
||||
return ENOMEM;
|
||||
m_alarm_timer = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Timer));
|
||||
}
|
||||
auto timer_was_added = TimerQueue::the().add_timer_without_id(*m_alarm_timer, CLOCK_REALTIME_COARSE, deadline, [this]() {
|
||||
[[maybe_unused]] auto rc = send_signal(SIGALRM, nullptr);
|
||||
|
|
Loading…
Reference in a new issue