aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/httpcli
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-07-29 15:58:11 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-07-29 15:58:11 -0700
commit5ddbb9d405c01564b935e9ab81ae2833124e0b12 (patch)
tree1fd4d868339987be609ebb96331c023272c7b065 /test/core/httpcli
parent4b6a0c73f318f6bc3d6e81676b06d8619e5e8325 (diff)
Allow specific pollers to be woken
Currently, if two threads call grpc_completion_queue_pluck on the same completion queue for different tags, there is a 50% chance that we deliver the completion wakeup to the wrong poller - forcing the correct poller to wait until its polling times out before it can return an event up to the application. This change tweaks our polling interfaces so that we can indeed wake a specific poller. Nothing has been performance tuned yet. It's definitely sub-optimal in a number of places. Wakeup file-descriptors should be recycled. We should have a path that avoids calling poll() followed by epoll(). We can probably live without it right at the second though. This code will fail on Windows at least (I'll do that port when I'm in the office and have a Windows machine).
Diffstat (limited to 'test/core/httpcli')
-rw-r--r--test/core/httpcli/httpcli_test.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c
index 4801eb3e39..390afcdf63 100644
--- a/test/core/httpcli/httpcli_test.c
+++ b/test/core/httpcli/httpcli_test.c
@@ -64,7 +64,7 @@ static void on_finish(void *arg, const grpc_httpcli_response *response) {
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
g_done = 1;
- grpc_pollset_kick(&g_pollset);
+ grpc_pollset_kick(&g_pollset, NULL);
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
}
@@ -87,7 +87,8 @@ static void test_get(int use_ssl, int port) {
(void *)42);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!g_done) {
- grpc_pollset_work(&g_pollset, n_seconds_time(20));
+ grpc_pollset_worker worker;
+ grpc_pollset_work(&g_pollset, &worker, n_seconds_time(20));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
gpr_free(host);
@@ -112,7 +113,8 @@ static void test_post(int use_ssl, int port) {
n_seconds_time(15), on_finish, (void *)42);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
while (!g_done) {
- grpc_pollset_work(&g_pollset, n_seconds_time(20));
+ grpc_pollset_worker worker;
+ grpc_pollset_work(&g_pollset, &worker, n_seconds_time(20));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
gpr_free(host);