1. Remove invalid assertion.
2. Properly recalculate delta in case pthread_cond_timedwait() is interrupted. 3. Style fix. Reported by: [1] App Deb <appdebgr@gmail.com>
This commit is contained in:
parent
e396eb604f
commit
1cc1967893
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214622
@ -308,9 +308,9 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime)
|
||||
struct timeval tv;
|
||||
clock_t delta;
|
||||
|
||||
ASSERT(abstime > 0);
|
||||
abstime += lbolt;
|
||||
top:
|
||||
delta = abstime;
|
||||
delta = abstime - lbolt;
|
||||
if (delta <= 0)
|
||||
return (-1);
|
||||
|
||||
@ -321,7 +321,7 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime)
|
||||
ts.tv_nsec = tv.tv_usec * 1000 + (delta % hz) * (NANOSEC / hz);
|
||||
ASSERT(ts.tv_nsec >= 0);
|
||||
|
||||
if(ts.tv_nsec >= NANOSEC) {
|
||||
if (ts.tv_nsec >= NANOSEC) {
|
||||
ts.tv_sec++;
|
||||
ts.tv_nsec -= NANOSEC;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user