diff options
author | Xin LI <delphij@FreeBSD.org> | 2016-01-21 08:50:56 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2016-01-21 08:50:56 +0000 |
commit | cbb26d1b6673ba1c6efd6e36a06fb6a56263b5fc (patch) | |
tree | 72c8a10ba42f04018a461504b789125f97944bda /libntp/ntp_worker.c | |
parent | c373d9289d1987abe45e339b5aa37f05460e977f (diff) |
Notes
Diffstat (limited to 'libntp/ntp_worker.c')
-rw-r--r-- | libntp/ntp_worker.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libntp/ntp_worker.c b/libntp/ntp_worker.c index f5642e10dc1ea..087f06c95308c 100644 --- a/libntp/ntp_worker.c +++ b/libntp/ntp_worker.c @@ -27,6 +27,8 @@ blocking_child ** blocking_children; size_t blocking_children_alloc; int worker_per_query; /* boolean */ int intres_req_pending; +volatile u_int blocking_child_ready_seen; +volatile u_int blocking_child_ready_done; #ifndef HAVE_IO_COMPLETION_PORT @@ -262,6 +264,31 @@ process_blocking_resp( req_child_exit(c); } +void +harvest_blocking_responses(void) +{ + int idx; + blocking_child* cp; + u_int scseen, scdone; + + scseen = blocking_child_ready_seen; + scdone = blocking_child_ready_done; + if (scdone != scseen) { + blocking_child_ready_done = scseen; + for (idx = 0; idx < blocking_children_alloc; idx++) { + cp = blocking_children[idx]; + if (NULL == cp) + continue; + scseen = cp->resp_ready_seen; + scdone = cp->resp_ready_done; + if (scdone != scseen) { + cp->resp_ready_done = scseen; + process_blocking_resp(cp); + } + } + } +} + /* * blocking_child_common runs as a forked child or a thread |