MCPcopy Create free account
hub / github.com/F-Stack/f-stack / seltdwait

Function seltdwait

freebsd/kern/sys_generic.c:1905–1935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1903}
1904
1905static int
1906seltdwait(struct thread *td, sbintime_t sbt, sbintime_t precision)
1907{
1908 struct seltd *stp;
1909 int error;
1910
1911 stp = td->td_sel;
1912 /*
1913 * An event of interest may occur while we do not hold the seltd
1914 * locked so check the pending flag before we sleep.
1915 */
1916 mtx_lock(&stp->st_mtx);
1917 /*
1918 * Any further calls to selrecord will be a rescan.
1919 */
1920 stp->st_flags |= SELTD_RESCAN;
1921 if (stp->st_flags & SELTD_PENDING) {
1922 mtx_unlock(&stp->st_mtx);
1923 return (0);
1924 }
1925 if (sbt == 0)
1926 error = EWOULDBLOCK;
1927 else if (sbt != -1)
1928 error = cv_timedwait_sig_sbt(&stp->st_wait, &stp->st_mtx,
1929 sbt, precision, C_ABSOLUTE);
1930 else
1931 error = cv_wait_sig(&stp->st_wait, &stp->st_mtx);
1932 mtx_unlock(&stp->st_mtx);
1933
1934 return (error);
1935}
1936
1937void
1938seltdfini(struct thread *td)

Callers 3

kern_selectFunction · 0.85
kern_pollFunction · 0.85
selsocketFunction · 0.85

Calls 3

mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70
cv_wait_sigFunction · 0.50

Tested by

no test coverage detected