diff options
author | Craig Tiller <ctiller@google.com> | 2015-05-29 13:59:39 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-05-29 13:59:39 -0700 |
commit | 127e390f076957755c7b6d21b1ddb75919a05a02 (patch) | |
tree | d2b79cc2baef0a22903a2633ec2cfc348889b796 /src/core | |
parent | 7f19a43ccadab2913a7585cd9ae8be7f1abac495 (diff) | |
parent | 1a6f755c1f00323a991101f4508ade0beb772b3d (diff) |
Merge branch 'but-maybe-i-want-to-poll' into we-dont-need-no-backup
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/iomgr/fd_posix.c | 4 | ||||
-rw-r--r-- | src/core/iomgr/pollset_multipoller_with_epoll.c | 6 | ||||
-rw-r--r-- | src/core/iomgr/pollset_multipoller_with_poll_posix.c | 10 | ||||
-rw-r--r-- | src/core/iomgr/pollset_posix.h | 6 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c index 3f2442eb00..5a7180a76b 100644 --- a/src/core/iomgr/fd_posix.c +++ b/src/core/iomgr/fd_posix.c @@ -164,7 +164,7 @@ static void maybe_wake_one_watcher(grpc_fd *fd) { gpr_mu_unlock(&fd->watcher_mu); } -static void wake_all_watchers(grpc_fd *fd) { +static void wake_all_watchers_locked(grpc_fd *fd) { grpc_fd_watcher *watcher; for (watcher = fd->inactive_watcher_root.next; watcher != &fd->inactive_watcher_root; watcher = watcher->next) { @@ -184,7 +184,7 @@ void grpc_fd_orphan(grpc_fd *fd, grpc_iomgr_cb_func on_done, void *user_data) { shutdown(fd->fd, SHUT_RDWR); ref_by(fd, 1); /* remove active status, but keep referenced */ gpr_mu_lock(&fd->watcher_mu); - wake_all_watchers(fd); + wake_all_watchers_locked(fd); gpr_mu_unlock(&fd->watcher_mu); unref_by(fd, 2); /* drop the reference */ } diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index 62cb959c16..abc8b091ba 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -160,8 +160,8 @@ static const grpc_pollset_vtable multipoll_with_epoll_pollset = { multipoll_with_epoll_pollset_maybe_work, epoll_kick, multipoll_with_epoll_pollset_destroy}; -void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, - size_t nfds) { +static void epoll_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, + size_t nfds) { size_t i; pollset_hdr *h = gpr_malloc(sizeof(pollset_hdr)); struct epoll_event ev; @@ -190,4 +190,6 @@ void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, } } +grpc_platform_become_multipoller_type grpc_platform_become_multipoller = epoll_become_multipoller; + #endif /* GPR_LINUX_MULTIPOLL_WITH_EPOLL */ diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c index 688191180a..24339a39bb 100644 --- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c +++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c @@ -33,7 +33,7 @@ #include <grpc/support/port_platform.h> -#ifdef GPR_POSIX_MULTIPOLL_WITH_POLL +#ifdef GPR_POSIX_SOCKET #include "src/core/iomgr/pollset_posix.h" @@ -226,8 +226,8 @@ static const grpc_pollset_vtable multipoll_with_poll_pollset = { multipoll_with_poll_pollset_maybe_work, multipoll_with_poll_pollset_kick, multipoll_with_poll_pollset_destroy}; -void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, - size_t nfds) { +void grpc_poll_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, + size_t nfds) { size_t i; pollset_hdr *h = gpr_malloc(sizeof(pollset_hdr)); pollset->vtable = &multipoll_with_poll_pollset; @@ -248,4 +248,8 @@ void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, } } +#endif /* GPR_POSIX_SOCKET */ + +#ifdef GPR_POSIX_MULTIPOLL_WITH_POLL +grpc_platform_become_multipoller_type grpc_platform_become_multipoller = grpc_poll_become_multipoller; #endif diff --git a/src/core/iomgr/pollset_posix.h b/src/core/iomgr/pollset_posix.h index c7c3fec0bf..54b38fbbdc 100644 --- a/src/core/iomgr/pollset_posix.h +++ b/src/core/iomgr/pollset_posix.h @@ -93,7 +93,11 @@ int grpc_kick_read_fd(grpc_pollset *p); void grpc_kick_drain(grpc_pollset *p); /* turn a pollset into a multipoller: platform specific */ -void grpc_platform_become_multipoller(grpc_pollset *pollset, +typedef void (*grpc_platform_become_multipoller_type)(grpc_pollset *pollset, + struct grpc_fd **fds, size_t fd_count); +extern grpc_platform_become_multipoller_type grpc_platform_become_multipoller; + +void grpc_poll_become_multipoller(grpc_pollset *pollset, struct grpc_fd **fds, size_t fd_count); #endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_POSIX_H */ |