|
|
@ -530,20 +530,38 @@ static grpc_error *pollset_kick(grpc_pollset *p, |
|
|
|
if (specific_worker == NULL) { |
|
|
|
if (specific_worker == NULL) { |
|
|
|
if (gpr_tls_get(&g_current_thread_pollset) != (intptr_t)p) { |
|
|
|
if (gpr_tls_get(&g_current_thread_pollset) != (intptr_t)p) { |
|
|
|
if (p->num_pollers == 0) { |
|
|
|
if (p->num_pollers == 0) { |
|
|
|
|
|
|
|
if (grpc_polling_trace) { |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "PS:%p kicked_without_poller", p); |
|
|
|
|
|
|
|
} |
|
|
|
p->kicked_without_poller = true; |
|
|
|
p->kicked_without_poller = true; |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (grpc_polling_trace) { |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "PS:%p kicked_via_wakeup_fd", p); |
|
|
|
|
|
|
|
} |
|
|
|
return grpc_wakeup_fd_wakeup(&p->pollset_wakeup); |
|
|
|
return grpc_wakeup_fd_wakeup(&p->pollset_wakeup); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (grpc_polling_trace) { |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "PS:%p kicked_but_awake", p); |
|
|
|
|
|
|
|
} |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (gpr_tls_get(&g_current_thread_worker) == |
|
|
|
} else if (gpr_tls_get(&g_current_thread_worker) == |
|
|
|
(intptr_t)specific_worker) { |
|
|
|
(intptr_t)specific_worker) { |
|
|
|
|
|
|
|
if (grpc_polling_trace) { |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "PS:%p kicked_but_awake", p); |
|
|
|
|
|
|
|
} |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
} else if (specific_worker == p->root_worker) { |
|
|
|
} else if (specific_worker == p->root_worker) { |
|
|
|
|
|
|
|
if (grpc_polling_trace) { |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "PS:%p kicked_via_wakeup_fd", p); |
|
|
|
|
|
|
|
} |
|
|
|
return grpc_wakeup_fd_wakeup(&p->pollset_wakeup); |
|
|
|
return grpc_wakeup_fd_wakeup(&p->pollset_wakeup); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (grpc_polling_trace) { |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "PS:%p kicked_via_cv", p); |
|
|
|
|
|
|
|
} |
|
|
|
gpr_cv_signal(&specific_worker->cv); |
|
|
|
gpr_cv_signal(&specific_worker->cv); |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
} |
|
|
|
} |
|
|
@ -716,9 +734,11 @@ static grpc_error *pollset_poll(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, |
|
|
|
bool read_ev = (events[i].events & (EPOLLIN | EPOLLPRI)) != 0; |
|
|
|
bool read_ev = (events[i].events & (EPOLLIN | EPOLLPRI)) != 0; |
|
|
|
bool write_ev = (events[i].events & EPOLLOUT) != 0; |
|
|
|
bool write_ev = (events[i].events & EPOLLOUT) != 0; |
|
|
|
if (grpc_polling_trace) { |
|
|
|
if (grpc_polling_trace) { |
|
|
|
gpr_log(GPR_DEBUG, |
|
|
|
gpr_log( |
|
|
|
"PS:%p poll got fd: is_wq=%d cancel=%d read=%d write=%d", |
|
|
|
GPR_DEBUG, |
|
|
|
pollset, is_workqueue, cancel, read_ev, write_ev); |
|
|
|
"PS:%p poll got fd %p(%d/%d): is_wq=%d cancel=%d read=%d write=%d", |
|
|
|
|
|
|
|
pollset, fd, fd->fd, fd->workqueue_wakeup_fd.read_fd, is_workqueue, |
|
|
|
|
|
|
|
cancel, read_ev, write_ev); |
|
|
|
} |
|
|
|
} |
|
|
|
if (is_workqueue) { |
|
|
|
if (is_workqueue) { |
|
|
|
append_error(&error, |
|
|
|
append_error(&error, |
|
|
|