diff options
author | Craig Tiller <ctiller@google.com> | 2016-05-24 13:49:50 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-05-24 13:49:50 -0700 |
commit | 53dd6b9e459d6d3fd08f50d820e2aa8486d305f1 (patch) | |
tree | d0caa405ce3f83ce5ec349f70dd3ac4f1d45b809 /src | |
parent | d7bbd38b27630f908fc4f1cb906607e44c8f30bb (diff) |
Round robin notifier pollset
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/iomgr/tcp_server_posix.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/lib/iomgr/tcp_server_posix.c b/src/core/lib/iomgr/tcp_server_posix.c index c695621de8..909e34abc7 100644 --- a/src/core/lib/iomgr/tcp_server_posix.c +++ b/src/core/lib/iomgr/tcp_server_posix.c @@ -128,6 +128,9 @@ struct grpc_tcp_server { grpc_pollset **pollsets; /* number of pollsets in the pollsets array */ size_t pollset_count; + + /* next pollset to assign a channel to */ + size_t next_pollset_to_assign; }; grpc_tcp_server *grpc_tcp_server_create(grpc_closure *shutdown_complete) { @@ -145,6 +148,7 @@ grpc_tcp_server *grpc_tcp_server_create(grpc_closure *shutdown_complete) { s->head = NULL; s->tail = NULL; s->nports = 0; + s->next_pollset_to_assign = 0; return s; } @@ -317,7 +321,9 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) { goto error; } - read_notifier_pollset = grpc_fd_get_read_notifier_pollset(exec_ctx, sp->emfd); + read_notifier_pollset = + sp->server->pollsets[(sp->server->next_pollset_to_assign++) % + sp->server->pollset_count]; /* loop until accept4 returns EAGAIN, and then re-arm notification */ for (;;) { |