mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Run callouts during infinite waiting inside cv_wait
During cv_wait we may be waiting for an event triggered by callout. Run callbacks here to avoid code blocking. Reviewed by: hselasky Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4144
This commit is contained in:
parent
bbcfaa4eb8
commit
5bb01ba335
1 changed files with 9 additions and 0 deletions
|
|
@ -138,6 +138,7 @@ cv_timedwait(struct cv *cv, struct mtx *mtx, int timo)
|
|||
{
|
||||
int start = ticks;
|
||||
int delta;
|
||||
int time = 0;
|
||||
|
||||
if (cv->sleeping)
|
||||
return (EWOULDBLOCK); /* not allowed */
|
||||
|
|
@ -154,6 +155,14 @@ cv_timedwait(struct cv *cv, struct mtx *mtx, int timo)
|
|||
|
||||
usb_idle();
|
||||
|
||||
if (++time >= (1000000 / hz)) {
|
||||
time = 0;
|
||||
callout_process(1);
|
||||
}
|
||||
|
||||
/* Sleep for 1 us */
|
||||
delay(1);
|
||||
|
||||
mtx_lock(mtx);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue