Merge pull request #2171 from ctiller/fix-polling

Remove return status from maybe_work.
pull/2184/head
Nicolas Noble 10 years ago
commit 04da718e90
  1. 3
      src/core/iomgr/pollset_multipoller_with_epoll.c
  2. 8
      src/core/iomgr/pollset_multipoller_with_poll_posix.c
  3. 12
      src/core/iomgr/pollset_posix.c
  4. 2
      src/core/iomgr/pollset_posix.h

@ -83,7 +83,7 @@ static void multipoll_with_epoll_pollset_del_fd(grpc_pollset *pollset,
/* TODO(klempner): We probably want to turn this down a bit */ /* TODO(klempner): We probably want to turn this down a bit */
#define GRPC_EPOLL_MAX_EVENTS 1000 #define GRPC_EPOLL_MAX_EVENTS 1000
static int multipoll_with_epoll_pollset_maybe_work( static void multipoll_with_epoll_pollset_maybe_work(
grpc_pollset *pollset, gpr_timespec deadline, gpr_timespec now, grpc_pollset *pollset, gpr_timespec deadline, gpr_timespec now,
int allow_synchronous_callback) { int allow_synchronous_callback) {
struct epoll_event ep_ev[GRPC_EPOLL_MAX_EVENTS]; struct epoll_event ep_ev[GRPC_EPOLL_MAX_EVENTS];
@ -133,7 +133,6 @@ static int multipoll_with_epoll_pollset_maybe_work(
gpr_mu_lock(&pollset->mu); gpr_mu_lock(&pollset->mu);
pollset->counter -= 1; pollset->counter -= 1;
return 1;
} }
static void multipoll_with_epoll_pollset_finish_shutdown( static void multipoll_with_epoll_pollset_finish_shutdown(

@ -103,7 +103,7 @@ static void end_polling(grpc_pollset *pollset) {
} }
} }
static int multipoll_with_poll_pollset_maybe_work( static void multipoll_with_poll_pollset_maybe_work(
grpc_pollset *pollset, gpr_timespec deadline, gpr_timespec now, grpc_pollset *pollset, gpr_timespec deadline, gpr_timespec now,
int allow_synchronous_callback) { int allow_synchronous_callback) {
int timeout; int timeout;
@ -126,7 +126,7 @@ static int multipoll_with_poll_pollset_maybe_work(
kfd = grpc_pollset_kick_pre_poll(&pollset->kick_state); kfd = grpc_pollset_kick_pre_poll(&pollset->kick_state);
if (kfd == NULL) { if (kfd == NULL) {
/* Already kicked */ /* Already kicked */
return 1; return;
} }
h->pfds[0].fd = GRPC_POLLSET_KICK_GET_FD(kfd); h->pfds[0].fd = GRPC_POLLSET_KICK_GET_FD(kfd);
h->pfds[0].events = POLLIN; h->pfds[0].events = POLLIN;
@ -154,7 +154,7 @@ static int multipoll_with_poll_pollset_maybe_work(
h->del_count = 0; h->del_count = 0;
if (h->pfd_count == 0) { if (h->pfd_count == 0) {
end_polling(pollset); end_polling(pollset);
return 0; return;
} }
pollset->counter++; pollset->counter++;
gpr_mu_unlock(&pollset->mu); gpr_mu_unlock(&pollset->mu);
@ -191,8 +191,6 @@ static int multipoll_with_poll_pollset_maybe_work(
gpr_mu_lock(&pollset->mu); gpr_mu_lock(&pollset->mu);
pollset->counter--; pollset->counter--;
return 1;
} }
static void multipoll_with_poll_pollset_kick(grpc_pollset *p) { static void multipoll_with_poll_pollset_kick(grpc_pollset *p) {

@ -123,7 +123,6 @@ static void finish_shutdown(grpc_pollset *pollset) {
int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline) { int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline) {
/* pollset->mu already held */ /* pollset->mu already held */
gpr_timespec now = gpr_now(); gpr_timespec now = gpr_now();
int r;
if (gpr_time_cmp(now, deadline) > 0) { if (gpr_time_cmp(now, deadline) > 0) {
return 0; return 0;
} }
@ -137,7 +136,7 @@ int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline) {
return 1; return 1;
} }
gpr_tls_set(&g_current_thread_poller, (gpr_intptr)pollset); gpr_tls_set(&g_current_thread_poller, (gpr_intptr)pollset);
r = pollset->vtable->maybe_work(pollset, deadline, now, 1); pollset->vtable->maybe_work(pollset, deadline, now, 1);
gpr_tls_set(&g_current_thread_poller, 0); gpr_tls_set(&g_current_thread_poller, 0);
if (pollset->shutting_down) { if (pollset->shutting_down) {
if (pollset->counter > 0) { if (pollset->counter > 0) {
@ -153,7 +152,7 @@ int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline) {
gpr_mu_lock(&pollset->mu); gpr_mu_lock(&pollset->mu);
} }
} }
return r; return 1;
} }
void grpc_pollset_shutdown(grpc_pollset *pollset, void grpc_pollset_shutdown(grpc_pollset *pollset,
@ -338,7 +337,7 @@ static void basic_pollset_del_fd(grpc_pollset *pollset, grpc_fd *fd) {
} }
} }
static int basic_pollset_maybe_work(grpc_pollset *pollset, static void basic_pollset_maybe_work(grpc_pollset *pollset,
gpr_timespec deadline, gpr_timespec now, gpr_timespec deadline, gpr_timespec now,
int allow_synchronous_callback) { int allow_synchronous_callback) {
struct pollfd pfd[2]; struct pollfd pfd[2];
@ -353,7 +352,7 @@ static int basic_pollset_maybe_work(grpc_pollset *pollset,
/* Give do_promote priority so we don't starve it out */ /* Give do_promote priority so we don't starve it out */
gpr_mu_unlock(&pollset->mu); gpr_mu_unlock(&pollset->mu);
gpr_mu_lock(&pollset->mu); gpr_mu_lock(&pollset->mu);
return 1; return;
} }
fd = pollset->data.ptr; fd = pollset->data.ptr;
if (fd && grpc_fd_is_orphaned(fd)) { if (fd && grpc_fd_is_orphaned(fd)) {
@ -364,7 +363,7 @@ static int basic_pollset_maybe_work(grpc_pollset *pollset,
kfd = grpc_pollset_kick_pre_poll(&pollset->kick_state); kfd = grpc_pollset_kick_pre_poll(&pollset->kick_state);
if (kfd == NULL) { if (kfd == NULL) {
/* Already kicked */ /* Already kicked */
return 1; return;
} }
pfd[0].fd = GRPC_POLLSET_KICK_GET_FD(kfd); pfd[0].fd = GRPC_POLLSET_KICK_GET_FD(kfd);
pfd[0].events = POLLIN; pfd[0].events = POLLIN;
@ -418,7 +417,6 @@ static int basic_pollset_maybe_work(grpc_pollset *pollset,
gpr_mu_lock(&pollset->mu); gpr_mu_lock(&pollset->mu);
pollset->counter--; pollset->counter--;
return 1;
} }
static void basic_pollset_destroy(grpc_pollset *pollset) { static void basic_pollset_destroy(grpc_pollset *pollset) {

@ -68,7 +68,7 @@ typedef struct grpc_pollset {
struct grpc_pollset_vtable { struct grpc_pollset_vtable {
void (*add_fd)(grpc_pollset *pollset, struct grpc_fd *fd); void (*add_fd)(grpc_pollset *pollset, struct grpc_fd *fd);
void (*del_fd)(grpc_pollset *pollset, struct grpc_fd *fd); void (*del_fd)(grpc_pollset *pollset, struct grpc_fd *fd);
int (*maybe_work)(grpc_pollset *pollset, gpr_timespec deadline, void (*maybe_work)(grpc_pollset *pollset, gpr_timespec deadline,
gpr_timespec now, int allow_synchronous_callback); gpr_timespec now, int allow_synchronous_callback);
void (*kick)(grpc_pollset *pollset); void (*kick)(grpc_pollset *pollset);
void (*finish_shutdown)(grpc_pollset *pollset); void (*finish_shutdown)(grpc_pollset *pollset);

Loading…
Cancel
Save