| 1903 | } |
| 1904 | |
| 1905 | static int |
| 1906 | seltdwait(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 | |
| 1937 | void |
| 1938 | seltdfini(struct thread *td) |
no test coverage detected