diff options
author | Renato Botelho <renato@netgate.com> | 2016-01-25 08:56:15 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-01-25 08:56:15 -0200 |
commit | eb84e0723f3b4bc5e40024f66fe21c14b09e9ec4 (patch) | |
tree | fec6b99d018e13f1fccbe31478aaf29a28a55642 /contrib/ntp/include/ntp_worker.h | |
parent | c50df8e1b90c4f9b8bbffa592477c129854776ce (diff) | |
parent | 94b1bbbd44bd88b6db1c00d795cdf7675b3ae254 (diff) | |
download | FreeBSD-src-eb84e0723f3b4bc5e40024f66fe21c14b09e9ec4.zip FreeBSD-src-eb84e0723f3b4bc5e40024f66fe21c14b09e9ec4.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'contrib/ntp/include/ntp_worker.h')
-rw-r--r-- | contrib/ntp/include/ntp_worker.h | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/contrib/ntp/include/ntp_worker.h b/contrib/ntp/include/ntp_worker.h index 50616b3..7720b8c 100644 --- a/contrib/ntp/include/ntp_worker.h +++ b/contrib/ntp/include/ntp_worker.h @@ -60,33 +60,35 @@ typedef sema_type *sem_ref; #if defined(WORK_FORK) typedef struct blocking_child_tag { - int reusable; - int pid; - int req_write_pipe; /* parent */ - int resp_read_pipe; - void * resp_read_ctx; - int req_read_pipe; /* child */ - int resp_write_pipe; - int ispipe; + int reusable; + int pid; + int req_write_pipe; /* parent */ + int resp_read_pipe; + void * resp_read_ctx; + int req_read_pipe; /* child */ + int resp_write_pipe; + int ispipe; + volatile u_int resp_ready_seen; /* signal/scan */ + volatile u_int resp_ready_done; /* consumer/mainloop */ } blocking_child; #elif defined(WORK_THREAD) typedef struct blocking_child_tag { -/* - * blocking workitems and blocking_responses are dynamically-sized - * one-dimensional arrays of pointers to blocking worker requests and - * responses. - * - * IMPORTANT: This structure is shared between threads, and all access - * that is not atomic (especially queue operations) must hold the - * 'accesslock' semaphore to avoid data races. - * - * The resource management (thread/semaphore creation/destruction) - * functions and functions just testing a handle are safe because these - * are only changed by the main thread when no worker is running on the - * same data structure. - */ + /* + * blocking workitems and blocking_responses are + * dynamically-sized one-dimensional arrays of pointers to + * blocking worker requests and responses. + * + * IMPORTANT: This structure is shared between threads, and all + * access that is not atomic (especially queue operations) must + * hold the 'accesslock' semaphore to avoid data races. + * + * The resource management (thread/semaphore + * creation/destruction) functions and functions just testing a + * handle are safe because these are only changed by the main + * thread when no worker is running on the same data structure. + */ int reusable; sem_ref accesslock; /* shared access lock */ thr_ref thread_ref; /* thread 'handle' */ @@ -117,6 +119,8 @@ typedef struct blocking_child_tag { int resp_write_pipe; /* child */ int ispipe; void * resp_read_ctx; /* child */ + volatile u_int resp_ready_seen; /* signal/scan */ + volatile u_int resp_ready_done; /* consumer/mainloop */ #else sem_ref responses_pending; /* signalling */ #endif @@ -126,6 +130,10 @@ typedef struct blocking_child_tag { #endif /* WORK_THREAD */ +/* we need some global tag to indicate any blocking child may be ready: */ +extern volatile u_int blocking_child_ready_seen;/* signal/scan */ +extern volatile u_int blocking_child_ready_done;/* consumer/mainloop */ + extern blocking_child ** blocking_children; extern size_t blocking_children_alloc; extern int worker_per_query; /* boolean */ @@ -139,6 +147,7 @@ extern int queue_blocking_response(blocking_child *, blocking_pipe_header *, size_t, const blocking_pipe_header *); extern void process_blocking_resp(blocking_child *); +extern void harvest_blocking_responses(void); extern int send_blocking_req_internal(blocking_child *, blocking_pipe_header *, void *); |