mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibC: Implement pselect
pselect() is similar() to select(), but it takes its timeout as timespec instead of as timeval, and it takes an additional sigmask parameter. Change the sys$select parameters to match pselect() and implement select() in terms of pselect().
This commit is contained in:
parent
29f509a2a0
commit
d23e655c83
Notes:
sideshowbarker
2024-07-19 05:27:20 +09:00
Author: https://github.com/nico
Commit: d23e655c83
Pull-request: https://github.com/SerenityOS/serenity/pull/2609
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bugaevc
6 changed files with 46 additions and 19 deletions
|
@ -210,8 +210,8 @@ bool Thread::SleepBlocker::should_unblock(Thread&, time_t, long)
|
|||
return m_wakeup_time <= g_uptime;
|
||||
}
|
||||
|
||||
Thread::SelectBlocker::SelectBlocker(const timeval& tv, bool select_has_timeout, const FDVector& read_fds, const FDVector& write_fds, const FDVector& except_fds)
|
||||
: m_select_timeout(tv)
|
||||
Thread::SelectBlocker::SelectBlocker(const timespec& ts, bool select_has_timeout, const FDVector& read_fds, const FDVector& write_fds, const FDVector& except_fds)
|
||||
: m_select_timeout(ts)
|
||||
, m_select_has_timeout(select_has_timeout)
|
||||
, m_select_read_fds(read_fds)
|
||||
, m_select_write_fds(write_fds)
|
||||
|
@ -222,7 +222,7 @@ Thread::SelectBlocker::SelectBlocker(const timeval& tv, bool select_has_timeout,
|
|||
bool Thread::SelectBlocker::should_unblock(Thread& thread, time_t now_sec, long now_usec)
|
||||
{
|
||||
if (m_select_has_timeout) {
|
||||
if (now_sec > m_select_timeout.tv_sec || (now_sec == m_select_timeout.tv_sec && now_usec >= m_select_timeout.tv_usec))
|
||||
if (now_sec > m_select_timeout.tv_sec || (now_sec == m_select_timeout.tv_sec && now_usec * 1000 >= m_select_timeout.tv_nsec))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue