mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:37:42 +00:00
Kernel: Use TRY() in sys$alarm()
This commit is contained in:
parent
b083b165a7
commit
e3b063581e
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…
Add table
Add a link
Reference in a new issue