Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_time.c
| Show First 20 Lines • Show All 565 Lines • ▼ Show 20 Lines | kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, | ||||
| } | } | ||||
| do { | do { | ||||
| ts = *rqt; | ts = *rqt; | ||||
| if ((flags & TIMER_ABSTIME) != 0) { | if ((flags & TIMER_ABSTIME) != 0) { | ||||
| if (is_abs_real) | if (is_abs_real) | ||||
| td->td_rtcgen = | td->td_rtcgen = | ||||
| atomic_load_acq_int(&rtc_generation); | atomic_load_acq_int(&rtc_generation); | ||||
| error = kern_clock_gettime(td, clock_id, &now); | error = kern_clock_gettime(td, clock_id, &now); | ||||
| KASSERT(error == 0, ("kern_clock_gettime: %d", error)); | if (error != 0) { | ||||
| td->td_rtcgen = 0; | |||||
| return (error); | |||||
| } | |||||
kib: I do not think it is neccessary. td_rtcgen is cleared by other threads to make sure that… | |||||
| timespecsub(&ts, &now, &ts); | timespecsub(&ts, &now, &ts); | ||||
| } | } | ||||
| if (ts.tv_sec < 0 || (ts.tv_sec == 0 && ts.tv_nsec == 0)) { | if (ts.tv_sec < 0 || (ts.tv_sec == 0 && ts.tv_nsec == 0)) { | ||||
| error = EWOULDBLOCK; | error = EWOULDBLOCK; | ||||
| break; | break; | ||||
| } | } | ||||
| if (ts.tv_sec > INT32_MAX / 2) { | if (ts.tv_sec > INT32_MAX / 2) { | ||||
| over = ts.tv_sec - INT32_MAX / 2; | over = ts.tv_sec - INT32_MAX / 2; | ||||
| ▲ Show 20 Lines • Show All 1,290 Lines • Show Last 20 Lines | |||||
I do not think it is neccessary. td_rtcgen is cleared by other threads to make sure that sleeping thread notices the wall clock change. There we are no longer intend sleeping, so I do not see point in maintaining rtcgen.