diff options
author | 2015-01-16 15:35:56 -0800 | |
---|---|---|
committer | 2015-01-16 15:42:31 -0800 | |
commit | 7f3ed1eda19eaf846df93b7c4d1ab1069ab0c130 (patch) | |
tree | 85d4602d24a6af6550dc5d41c3c294b642d85bb0 /src/core/iomgr/pollset_multipoller_with_poll_posix.c | |
parent | beddbdaef22989309e4adf996843efc25d1891bd (diff) |
Factor out the pollset kicking mechanism and eliminate sharding
This change pulls out a separate pollset_kick module, which currently
uses a freelist of pipes dynamically assigned to pollsets when they
enter polling rather than the previous racy sharding mechanism.
We ultimately may wish to eliminate the dynamic assignment for multipoll
sets, but this should be sufficient for the moment.
Diffstat (limited to 'src/core/iomgr/pollset_multipoller_with_poll_posix.c')
-rw-r--r-- | src/core/iomgr/pollset_multipoller_with_poll_posix.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c index e482da94f7..7c9a9491cb 100644 --- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c +++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c @@ -131,7 +131,11 @@ static int multipoll_with_poll_pollset_maybe_work( } nf = 0; np = 1; - h->pfds[0].fd = grpc_kick_read_fd(pollset); + h->pfds[0].fd = grpc_pollset_kick_pre_poll(&pollset->kick_state); + if (h->pfds[0].fd < 0) { + /* Already kicked */ + return 1; + } h->pfds[0].events = POLLIN; h->pfds[0].revents = POLLOUT; for (i = 0; i < h->fd_count; i++) { @@ -173,7 +177,7 @@ static int multipoll_with_poll_pollset_maybe_work( /* do nothing */ } else { if (h->pfds[0].revents & POLLIN) { - grpc_kick_drain(pollset); + grpc_pollset_kick_consume(&pollset->kick_state); } for (i = 1; i < np; i++) { if (h->pfds[i].revents & POLLIN) { @@ -184,6 +188,7 @@ static int multipoll_with_poll_pollset_maybe_work( } } } + grpc_pollset_kick_post_poll(&pollset->kick_state); end_polling(pollset); gpr_mu_lock(&pollset->mu); |