mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
Kernel: If a process is interrupted during usleep(), return -EINTR
This commit is contained in:
parent
ac2cc7d78f
commit
2c693094d9
Notes:
sideshowbarker
2024-07-19 11:20:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2c693094d97
1 changed files with 2 additions and 5 deletions
|
@ -1514,12 +1514,9 @@ int Process::sys$usleep(useconds_t usec)
|
|||
{
|
||||
if (!usec)
|
||||
return 0;
|
||||
|
||||
u64 wakeup_time = current->sleep(usec / 1000);
|
||||
if (wakeup_time > g_uptime) {
|
||||
u32 ticks_left_until_original_wakeup_time = wakeup_time - g_uptime;
|
||||
return ticks_left_until_original_wakeup_time / TICKS_PER_SECOND;
|
||||
}
|
||||
if (wakeup_time > g_uptime)
|
||||
return -EINTR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue