/* * worker_resp_cb() is invoked when resp_read_pipe is readable. */ void worker_resp_cb( evutil_socket_t fd, short what, void * ctx /* blocking_child * */ ) { blocking_child * c; DEBUG_INSIST(EV_READ & what); c = ctx; DEBUG_INSIST(fd == c->resp_read_pipe); process_blocking_resp(c); }
/* -------------------------------------------------------------------- * Find the shared context that associates to an OS handle and make sure * the data is dequeued and processed. */ void handle_blocking_resp_sem( void * context ) { blocking_child * c; u_int idx; c = NULL; for (idx = 0; idx < blocking_children_alloc; idx++) { c = blocking_children[idx]; if (c != NULL && c->thread_ref != NULL && same_os_sema(c->responses_pending, context)) break; } if (idx < blocking_children_alloc) process_blocking_resp(c); }
void handle_blocking_resp_sem( void * context ) { HANDLE ready; blocking_child * c; u_int idx; ready = (HANDLE)context; c = NULL; for (idx = 0; idx < blocking_children_alloc; idx++) { c = blocking_children[idx]; if (c != NULL && c->thread_ref != NULL && ready == c->blocking_response_ready) break; } if (idx < blocking_children_alloc) process_blocking_resp(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); } } } }