aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/iomgr_posix.cc
diff options
context:
space:
mode:
authorGravatar Guantao Liu <guantaol@google.com>2019-01-07 18:22:50 -0800
committerGravatar Guantao Liu <guantaol@google.com>2019-01-07 18:22:50 -0800
commit11eff929e24cae59ed21c2f3a0bde22a6dbe0d91 (patch)
tree7f540f95825292ef732f7e35a3e646c9dbf56c6c /src/core/lib/iomgr/iomgr_posix.cc
parent8dcda4dc36aa4e4d3a4c46023f6470b4c1ec7bca (diff)
Avoid the thread jump in server callback APIs.
Add a utility function in iomgr to check whether the caller thread is a worker for any background poller, and keep grpc combiner from offloading closures to the default executor if the current thread is a worker for any background poller.
Diffstat (limited to 'src/core/lib/iomgr/iomgr_posix.cc')
-rw-r--r--src/core/lib/iomgr/iomgr_posix.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/lib/iomgr/iomgr_posix.cc b/src/core/lib/iomgr/iomgr_posix.cc
index 9386adf060..278c8de688 100644
--- a/src/core/lib/iomgr/iomgr_posix.cc
+++ b/src/core/lib/iomgr/iomgr_posix.cc
@@ -55,9 +55,14 @@ static void iomgr_platform_shutdown_background_closure(void) {
grpc_shutdown_background_closure();
}
+static bool iomgr_platform_is_any_background_poller_thread(void) {
+ return grpc_is_any_background_poller_thread();
+}
+
static grpc_iomgr_platform_vtable vtable = {
iomgr_platform_init, iomgr_platform_flush, iomgr_platform_shutdown,
- iomgr_platform_shutdown_background_closure};
+ iomgr_platform_shutdown_background_closure,
+ iomgr_platform_is_any_background_poller_thread};
void grpc_set_default_iomgr_platform() {
grpc_set_tcp_client_impl(&grpc_posix_tcp_client_vtable);