diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-10-13 16:07:13 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-10-18 17:12:19 -0700 |
commit | 0ee7574732a06e8cace4e099a678f4bd5dbff679 (patch) | |
tree | e43d5de442fdcc3d39cd5af687f319fa39612d3f /src/core/lib/iomgr/tcp_server.h | |
parent | 6bf5f833efe2cb9e2ecc14358dd9699cd5d05263 (diff) |
Removing instances of exec_ctx being passed around in functions in
src/core. exec_ctx is now a thread_local pointer of type ExecCtx instead of
grpc_exec_ctx which is initialized whenever ExecCtx is instantiated. ExecCtx
also keeps track of the previous exec_ctx so that nesting of exec_ctx is
allowed. This means that there is only one exec_ctx being used at any
time. Also, grpc_exec_ctx_finish is called in the destructor of the
object, and the previous exec_ctx is restored to avoid breaking current
functionality. The code still explicitly calls grpc_exec_ctx_finish
because removing all such instances causes the code to break.
Diffstat (limited to 'src/core/lib/iomgr/tcp_server.h')
-rw-r--r-- | src/core/lib/iomgr/tcp_server.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/core/lib/iomgr/tcp_server.h b/src/core/lib/iomgr/tcp_server.h index 8f9ce3819e..eb6f593501 100644 --- a/src/core/lib/iomgr/tcp_server.h +++ b/src/core/lib/iomgr/tcp_server.h @@ -43,22 +43,20 @@ typedef struct grpc_tcp_server_acceptor { /* Called for newly connected TCP connections. Takes ownership of acceptor. */ -typedef void (*grpc_tcp_server_cb)(grpc_exec_ctx *exec_ctx, void *arg, - grpc_endpoint *ep, +typedef void (*grpc_tcp_server_cb)(void *arg, grpc_endpoint *ep, grpc_pollset *accepting_pollset, grpc_tcp_server_acceptor *acceptor); /* Create a server, initially not bound to any ports. The caller owns one ref. If shutdown_complete is not NULL, it will be used by grpc_tcp_server_unref() when the ref count reaches zero. */ -grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx, - grpc_closure *shutdown_complete, +grpc_error *grpc_tcp_server_create(grpc_closure *shutdown_complete, const grpc_channel_args *args, grpc_tcp_server **server); /* Start listening to bound ports */ -void grpc_tcp_server_start(grpc_exec_ctx *exec_ctx, grpc_tcp_server *server, - grpc_pollset **pollsets, size_t pollset_count, +void grpc_tcp_server_start(grpc_tcp_server *server, grpc_pollset **pollsets, + size_t pollset_count, grpc_tcp_server_cb on_accept_cb, void *cb_arg); /* Add a port to the server, returning the newly allocated port on success, or @@ -96,11 +94,10 @@ void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s, /* If the refcount drops to zero, enqueue calls on exec_ctx to shutdown_listeners and delete s. */ -void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s); +void grpc_tcp_server_unref(grpc_tcp_server *s); /* Shutdown the fds of listeners. */ -void grpc_tcp_server_shutdown_listeners(grpc_exec_ctx *exec_ctx, - grpc_tcp_server *s); +void grpc_tcp_server_shutdown_listeners(grpc_tcp_server *s); #ifdef __cplusplus } |