Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/kshim/bsd_kernel.c
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | cv_wait(struct cv *cv, struct mtx *mtx) | ||||
cv_timedwait(cv, mtx, -1); | cv_timedwait(cv, mtx, -1); | ||||
} | } | ||||
int | int | ||||
cv_timedwait(struct cv *cv, struct mtx *mtx, int timo) | cv_timedwait(struct cv *cv, struct mtx *mtx, int timo) | ||||
{ | { | ||||
int start = ticks; | int start = ticks; | ||||
int delta; | int delta; | ||||
int time = 0; | |||||
if (cv->sleeping) | if (cv->sleeping) | ||||
return (EWOULDBLOCK); /* not allowed */ | return (EWOULDBLOCK); /* not allowed */ | ||||
cv->sleeping = 1; | cv->sleeping = 1; | ||||
while (cv->sleeping) { | while (cv->sleeping) { | ||||
if (timo >= 0) { | if (timo >= 0) { | ||||
delta = ticks - start; | delta = ticks - start; | ||||
if (delta >= timo || delta < 0) | if (delta >= timo || delta < 0) | ||||
break; | break; | ||||
} | } | ||||
wma_semihalf.com: Not sure how that got here, will be removed. | |||||
mtx_unlock(mtx); | mtx_unlock(mtx); | ||||
usb_idle(); | usb_idle(); | ||||
mtx_lock(mtx); | mtx_lock(mtx); | ||||
hselaskyUnsubmitted Not Done Inline ActionsThis lock should be moved after the delay(1000); hselasky: This lock should be moved after the delay(1000); | |||||
Not Done Inline ActionsHi, --HPS hselasky: Hi,
I think the long delay might affect the performance of some existing boot code. Could you… | |||||
if (++time >= (1000 / hz)) { | |||||
time = 0; | |||||
callout_process(1); | |||||
} | |||||
/* Sleep for 1 ms */ | |||||
delay(1000); | |||||
} | } | ||||
if (cv->sleeping) { | if (cv->sleeping) { | ||||
cv->sleeping = 0; | cv->sleeping = 0; | ||||
return (EWOULDBLOCK); /* not allowed */ | return (EWOULDBLOCK); /* not allowed */ | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,074 Lines • Show Last 20 Lines |
Not sure how that got here, will be removed.