aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD8
-rw-r--r--Makefile4
-rw-r--r--build.json4
-rw-r--r--src/core/iomgr/pollset_kick.h74
-rw-r--r--src/core/iomgr/pollset_kick_posix.c (renamed from src/core/iomgr/pollset_kick.c)33
-rw-r--r--src/core/iomgr/pollset_kick_posix.h34
-rw-r--r--src/core/iomgr/pollset_kick_windows.h48
-rw-r--r--src/core/iomgr/pollset_multipoller_with_poll_posix.c10
-rw-r--r--src/core/iomgr/pollset_posix.c10
-rw-r--r--src/core/iomgr/pollset_posix.h2
-rw-r--r--test/core/iomgr/poll_kick_posix_test.c43
-rw-r--r--vsprojects/grpc/grpc.vcxproj4
-rw-r--r--vsprojects/grpc/grpc.vcxproj.filters8
-rw-r--r--vsprojects/grpc_unsecure/grpc_unsecure.vcxproj4
-rw-r--r--vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters8
15 files changed, 95 insertions, 199 deletions
diff --git a/BUILD b/BUILD
index f7fdd44981..32461813f2 100644
--- a/BUILD
+++ b/BUILD
@@ -167,9 +167,7 @@ cc_library(
"src/core/iomgr/iomgr_internal.h",
"src/core/iomgr/iomgr_posix.h",
"src/core/iomgr/pollset.h",
- "src/core/iomgr/pollset_kick.h",
"src/core/iomgr/pollset_kick_posix.h",
- "src/core/iomgr/pollset_kick_windows.h",
"src/core/iomgr/pollset_posix.h",
"src/core/iomgr/pollset_set_posix.h",
"src/core/iomgr/pollset_set_windows.h",
@@ -276,7 +274,7 @@ cc_library(
"src/core/iomgr/iomgr.c",
"src/core/iomgr/iomgr_posix.c",
"src/core/iomgr/iomgr_windows.c",
- "src/core/iomgr/pollset_kick.c",
+ "src/core/iomgr/pollset_kick_posix.c",
"src/core/iomgr/pollset_multipoller_with_epoll.c",
"src/core/iomgr/pollset_multipoller_with_poll_posix.c",
"src/core/iomgr/pollset_posix.c",
@@ -398,9 +396,7 @@ cc_library(
"src/core/iomgr/iomgr_internal.h",
"src/core/iomgr/iomgr_posix.h",
"src/core/iomgr/pollset.h",
- "src/core/iomgr/pollset_kick.h",
"src/core/iomgr/pollset_kick_posix.h",
- "src/core/iomgr/pollset_kick_windows.h",
"src/core/iomgr/pollset_posix.h",
"src/core/iomgr/pollset_set_posix.h",
"src/core/iomgr/pollset_set_windows.h",
@@ -487,7 +483,7 @@ cc_library(
"src/core/iomgr/iomgr.c",
"src/core/iomgr/iomgr_posix.c",
"src/core/iomgr/iomgr_windows.c",
- "src/core/iomgr/pollset_kick.c",
+ "src/core/iomgr/pollset_kick_posix.c",
"src/core/iomgr/pollset_multipoller_with_epoll.c",
"src/core/iomgr/pollset_multipoller_with_poll_posix.c",
"src/core/iomgr/pollset_posix.c",
diff --git a/Makefile b/Makefile
index 0a417e867e..26a5d7e4ec 100644
--- a/Makefile
+++ b/Makefile
@@ -2718,7 +2718,7 @@ LIBGRPC_SRC = \
src/core/iomgr/iomgr.c \
src/core/iomgr/iomgr_posix.c \
src/core/iomgr/iomgr_windows.c \
- src/core/iomgr/pollset_kick.c \
+ src/core/iomgr/pollset_kick_posix.c \
src/core/iomgr/pollset_multipoller_with_epoll.c \
src/core/iomgr/pollset_multipoller_with_poll_posix.c \
src/core/iomgr/pollset_posix.c \
@@ -2968,7 +2968,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/iomgr/iomgr.c \
src/core/iomgr/iomgr_posix.c \
src/core/iomgr/iomgr_windows.c \
- src/core/iomgr/pollset_kick.c \
+ src/core/iomgr/pollset_kick_posix.c \
src/core/iomgr/pollset_multipoller_with_epoll.c \
src/core/iomgr/pollset_multipoller_with_poll_posix.c \
src/core/iomgr/pollset_posix.c \
diff --git a/build.json b/build.json
index 1017dc10f1..a59391bb75 100644
--- a/build.json
+++ b/build.json
@@ -115,9 +115,7 @@
"src/core/iomgr/iomgr_internal.h",
"src/core/iomgr/iomgr_posix.h",
"src/core/iomgr/pollset.h",
- "src/core/iomgr/pollset_kick.h",
"src/core/iomgr/pollset_kick_posix.h",
- "src/core/iomgr/pollset_kick_windows.h",
"src/core/iomgr/pollset_posix.h",
"src/core/iomgr/pollset_set_posix.h",
"src/core/iomgr/pollset_set_windows.h",
@@ -205,7 +203,7 @@
"src/core/iomgr/iomgr.c",
"src/core/iomgr/iomgr_posix.c",
"src/core/iomgr/iomgr_windows.c",
- "src/core/iomgr/pollset_kick.c",
+ "src/core/iomgr/pollset_kick_posix.c",
"src/core/iomgr/pollset_multipoller_with_epoll.c",
"src/core/iomgr/pollset_multipoller_with_poll_posix.c",
"src/core/iomgr/pollset_posix.c",
diff --git a/src/core/iomgr/pollset_kick.h b/src/core/iomgr/pollset_kick.h
deleted file mode 100644
index cc9357de1f..0000000000
--- a/src/core/iomgr/pollset_kick.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H
-#define GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H
-
-#include <grpc/support/port_platform.h>
-
-#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/pollset_kick_posix.h"
-#endif
-
-#ifdef GPR_WIN32
-#include "src/core/iomgr/pollset_kick_windows.h"
-#endif
-
-/* This is an abstraction around the typical pipe mechanism for waking up a
- thread sitting in a poll() style call. */
-
-void grpc_pollset_kick_global_init(void);
-void grpc_pollset_kick_global_destroy(void);
-
-void grpc_pollset_kick_init(grpc_pollset_kick_state *kick_state);
-void grpc_pollset_kick_destroy(grpc_pollset_kick_state *kick_state);
-
-/* Guarantees a pure posix implementation rather than a specialized one, if
- * applicable. Intended for testing. */
-void grpc_pollset_kick_global_init_fallback_fd(void);
-
-/* Must be called before entering poll(). If return value is -1, this consumed
- an existing kick. Otherwise the return value is an FD to add to the poll set.
- */
-int grpc_pollset_kick_pre_poll(grpc_pollset_kick_state *kick_state);
-
-/* Consume an existing kick. Must be called after poll returns that the fd was
- readable, and before calling kick_post_poll. */
-void grpc_pollset_kick_consume(grpc_pollset_kick_state *kick_state);
-
-/* Must be called after pre_poll, and after consume if applicable */
-void grpc_pollset_kick_post_poll(grpc_pollset_kick_state *kick_state);
-
-void grpc_pollset_kick_kick(grpc_pollset_kick_state *kick_state);
-
-#endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_H */
diff --git a/src/core/iomgr/pollset_kick.c b/src/core/iomgr/pollset_kick_posix.c
index f0211b8274..21c9bb6542 100644
--- a/src/core/iomgr/pollset_kick.c
+++ b/src/core/iomgr/pollset_kick_posix.c
@@ -34,7 +34,7 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/pollset_kick.h"
+#include "src/core/iomgr/pollset_kick_posix.h"
#include <errno.h>
#include <string.h>
@@ -96,41 +96,46 @@ static void free_wfd(grpc_kick_fd_info *fd_info) {
void grpc_pollset_kick_init(grpc_pollset_kick_state *kick_state) {
gpr_mu_init(&kick_state->mu);
kick_state->kicked = 0;
- kick_state->fd_info = NULL;
+ kick_state->fd_list.next = kick_state->fd_list.prev = &kick_state->fd_list;
}
void grpc_pollset_kick_destroy(grpc_pollset_kick_state *kick_state) {
gpr_mu_destroy(&kick_state->mu);
- GPR_ASSERT(kick_state->fd_info == NULL);
+ GPR_ASSERT(kick_state->fd_list.next == &kick_state->fd_list);
}
-int grpc_pollset_kick_pre_poll(grpc_pollset_kick_state *kick_state) {
+grpc_kick_fd_info *grpc_pollset_kick_pre_poll(grpc_pollset_kick_state *kick_state) {
+ grpc_kick_fd_info *fd_info;
gpr_mu_lock(&kick_state->mu);
if (kick_state->kicked) {
kick_state->kicked = 0;
gpr_mu_unlock(&kick_state->mu);
- return -1;
+ return NULL;
}
- kick_state->fd_info = allocate_wfd();
+ fd_info = allocate_wfd();
+ fd_info->next = &kick_state->fd_list;
+ fd_info->prev = fd_info->next->prev;
+ fd_info->next->prev = fd_info->prev->next = fd_info;
gpr_mu_unlock(&kick_state->mu);
- return GRPC_WAKEUP_FD_GET_READ_FD(&kick_state->fd_info->wakeup_fd);
+ return fd_info;
}
-void grpc_pollset_kick_consume(grpc_pollset_kick_state *kick_state) {
- grpc_wakeup_fd_consume_wakeup(&kick_state->fd_info->wakeup_fd);
+void grpc_pollset_kick_consume(grpc_pollset_kick_state *kick_state, grpc_kick_fd_info *fd_info) {
+ grpc_wakeup_fd_consume_wakeup(&fd_info->wakeup_fd);
}
-void grpc_pollset_kick_post_poll(grpc_pollset_kick_state *kick_state) {
+void grpc_pollset_kick_post_poll(grpc_pollset_kick_state *kick_state, grpc_kick_fd_info *fd_info) {
gpr_mu_lock(&kick_state->mu);
- free_wfd(kick_state->fd_info);
- kick_state->fd_info = NULL;
+ fd_info->next->prev = fd_info->prev;
+ fd_info->prev->next = fd_info->next;
+ free_wfd(fd_info);
gpr_mu_unlock(&kick_state->mu);
}
void grpc_pollset_kick_kick(grpc_pollset_kick_state *kick_state) {
gpr_mu_lock(&kick_state->mu);
- if (kick_state->fd_info != NULL) {
- grpc_wakeup_fd_wakeup(&kick_state->fd_info->wakeup_fd);
+ if (kick_state->fd_list.next != &kick_state->fd_list) {
+ grpc_wakeup_fd_wakeup(&kick_state->fd_list.next->wakeup_fd);
} else {
kick_state->kicked = 1;
}
diff --git a/src/core/iomgr/pollset_kick_posix.h b/src/core/iomgr/pollset_kick_posix.h
index 427699198c..b35c2cfbe0 100644
--- a/src/core/iomgr/pollset_kick_posix.h
+++ b/src/core/iomgr/pollset_kick_posix.h
@@ -39,13 +39,45 @@
typedef struct grpc_kick_fd_info {
grpc_wakeup_fd_info wakeup_fd;
+ /* used for polling list and free list */
struct grpc_kick_fd_info *next;
+ /* only used when polling */
+ struct grpc_kick_fd_info *prev;
} grpc_kick_fd_info;
typedef struct grpc_pollset_kick_state {
gpr_mu mu;
int kicked;
- struct grpc_kick_fd_info *fd_info;
+ struct grpc_kick_fd_info fd_list;
} grpc_pollset_kick_state;
+#define GRPC_POLLSET_KICK_GET_FD(kick_fd_info) GRPC_WAKEUP_FD_GET_READ_FD(&(kick_fd_info)->wakeup_fd)
+
+/* This is an abstraction around the typical pipe mechanism for waking up a
+ thread sitting in a poll() style call. */
+
+void grpc_pollset_kick_global_init(void);
+void grpc_pollset_kick_global_destroy(void);
+
+void grpc_pollset_kick_init(grpc_pollset_kick_state *kick_state);
+void grpc_pollset_kick_destroy(grpc_pollset_kick_state *kick_state);
+
+/* Guarantees a pure posix implementation rather than a specialized one, if
+ * applicable. Intended for testing. */
+void grpc_pollset_kick_global_init_fallback_fd(void);
+
+/* Must be called before entering poll(). If return value is -1, this consumed
+ an existing kick. Otherwise the return value is an FD to add to the poll set.
+ */
+grpc_kick_fd_info *grpc_pollset_kick_pre_poll(grpc_pollset_kick_state *kick_state);
+
+/* Consume an existing kick. Must be called after poll returns that the fd was
+ readable, and before calling kick_post_poll. */
+void grpc_pollset_kick_consume(grpc_pollset_kick_state *kick_state, grpc_kick_fd_info *fd_info);
+
+/* Must be called after pre_poll, and after consume if applicable */
+void grpc_pollset_kick_post_poll(grpc_pollset_kick_state *kick_state, grpc_kick_fd_info *fd_info);
+
+void grpc_pollset_kick_kick(grpc_pollset_kick_state *kick_state);
+
#endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_POSIX_H */
diff --git a/src/core/iomgr/pollset_kick_windows.h b/src/core/iomgr/pollset_kick_windows.h
deleted file mode 100644
index c675c119ab..0000000000
--- a/src/core/iomgr/pollset_kick_windows.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_WINDOWS_H
-#define GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_WINDOWS_H
-
-#include <grpc/support/sync.h>
-
-/* There isn't really any such thing as a pollset under Windows, due to the
- nature of the IO completion ports. */
-
-struct grpc_kick_fd_info;
-
-typedef struct grpc_pollset_kick_state {
- int unused;
-} grpc_pollset_kick_state;
-
-#endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_KICK_WINDOWS_H */
diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c
index b263001739..688191180a 100644
--- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c
+++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c
@@ -109,6 +109,7 @@ static int multipoll_with_poll_pollset_maybe_work(
int r;
size_t i, np, nf, nd;
pollset_hdr *h;
+ grpc_kick_fd_info *kfd;
h = pollset->data.ptr;
if (gpr_time_cmp(deadline, gpr_inf_future) == 0) {
@@ -128,11 +129,12 @@ static int multipoll_with_poll_pollset_maybe_work(
}
nf = 0;
np = 1;
- h->pfds[0].fd = grpc_pollset_kick_pre_poll(&pollset->kick_state);
- if (h->pfds[0].fd < 0) {
+ kfd = grpc_pollset_kick_pre_poll(&pollset->kick_state);
+ if (kfd == NULL) {
/* Already kicked */
return 1;
}
+ h->pfds[0].fd = GRPC_POLLSET_KICK_GET_FD(kfd);
h->pfds[0].events = POLLIN;
h->pfds[0].revents = POLLOUT;
for (i = 0; i < h->fd_count; i++) {
@@ -180,7 +182,7 @@ static int multipoll_with_poll_pollset_maybe_work(
/* do nothing */
} else {
if (h->pfds[0].revents & POLLIN) {
- grpc_pollset_kick_consume(&pollset->kick_state);
+ grpc_pollset_kick_consume(&pollset->kick_state, kfd);
}
for (i = 1; i < np; i++) {
if (h->pfds[i].revents & (POLLIN | POLLHUP | POLLERR)) {
@@ -191,7 +193,7 @@ static int multipoll_with_poll_pollset_maybe_work(
}
}
}
- grpc_pollset_kick_post_poll(&pollset->kick_state);
+ grpc_pollset_kick_post_poll(&pollset->kick_state, kfd);
gpr_mu_lock(&pollset->mu);
pollset->counter--;
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 8b9108649c..888bfe849f 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -318,6 +318,7 @@ static int basic_pollset_maybe_work(grpc_pollset *pollset,
struct pollfd pfd[2];
grpc_fd *fd;
grpc_fd_watcher fd_watcher;
+ grpc_kick_fd_info *kfd;
int timeout;
int r;
int nfds;
@@ -339,11 +340,12 @@ static int basic_pollset_maybe_work(grpc_pollset *pollset,
return 1;
}
}
- pfd[0].fd = grpc_pollset_kick_pre_poll(&pollset->kick_state);
- if (pfd[0].fd < 0) {
+ kfd = grpc_pollset_kick_pre_poll(&pollset->kick_state);
+ if (kfd == NULL) {
/* Already kicked */
return 1;
}
+ pfd[0].fd = GRPC_POLLSET_KICK_GET_FD(kfd);
pfd[0].events = POLLIN;
pfd[0].revents = 0;
nfds = 1;
@@ -379,7 +381,7 @@ static int basic_pollset_maybe_work(grpc_pollset *pollset,
/* do nothing */
} else {
if (pfd[0].revents & POLLIN) {
- grpc_pollset_kick_consume(&pollset->kick_state);
+ grpc_pollset_kick_consume(&pollset->kick_state, kfd);
}
if (pfd[1].revents & (POLLIN | POLLHUP | POLLERR)) {
grpc_fd_become_readable(fd, allow_synchronous_callback);
@@ -389,7 +391,7 @@ static int basic_pollset_maybe_work(grpc_pollset *pollset,
}
}
- grpc_pollset_kick_post_poll(&pollset->kick_state);
+ grpc_pollset_kick_post_poll(&pollset->kick_state, kfd);
gpr_mu_lock(&pollset->mu);
pollset->counter--;
diff --git a/src/core/iomgr/pollset_posix.h b/src/core/iomgr/pollset_posix.h
index ff9e119252..c7c3fec0bf 100644
--- a/src/core/iomgr/pollset_posix.h
+++ b/src/core/iomgr/pollset_posix.h
@@ -36,7 +36,7 @@
#include <grpc/support/sync.h>
-#include "src/core/iomgr/pollset_kick.h"
+#include "src/core/iomgr/pollset_kick_posix.h"
typedef struct grpc_pollset_vtable grpc_pollset_vtable;
diff --git a/test/core/iomgr/poll_kick_posix_test.c b/test/core/iomgr/poll_kick_posix_test.c
index 2c5b444d3a..123b1580bc 100644
--- a/test/core/iomgr/poll_kick_posix_test.c
+++ b/test/core/iomgr/poll_kick_posix_test.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/iomgr/pollset_kick.h"
+#include "src/core/iomgr/pollset_kick_posix.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -45,31 +45,31 @@ static void test_allocation(void) {
static void test_non_kick(void) {
grpc_pollset_kick_state state;
- int fd;
+ grpc_kick_fd_info *kfd;
grpc_pollset_kick_init(&state);
- fd = grpc_pollset_kick_pre_poll(&state);
- GPR_ASSERT(fd >= 0);
+ kfd = grpc_pollset_kick_pre_poll(&state);
+ GPR_ASSERT(kfd != NULL);
- grpc_pollset_kick_post_poll(&state);
+ grpc_pollset_kick_post_poll(&state, kfd);
grpc_pollset_kick_destroy(&state);
}
static void test_basic_kick(void) {
/* Kicked during poll */
grpc_pollset_kick_state state;
- int fd;
+ grpc_kick_fd_info *kfd;
grpc_pollset_kick_init(&state);
- fd = grpc_pollset_kick_pre_poll(&state);
- GPR_ASSERT(fd >= 0);
+ kfd = grpc_pollset_kick_pre_poll(&state);
+ GPR_ASSERT(kfd != NULL);
grpc_pollset_kick_kick(&state);
/* Now hypothetically we polled and found that we were kicked */
- grpc_pollset_kick_consume(&state);
+ grpc_pollset_kick_consume(&state, kfd);
- grpc_pollset_kick_post_poll(&state);
+ grpc_pollset_kick_post_poll(&state, kfd);
grpc_pollset_kick_destroy(&state);
}
@@ -77,13 +77,13 @@ static void test_basic_kick(void) {
static void test_non_poll_kick(void) {
/* Kick before entering poll */
grpc_pollset_kick_state state;
- int fd;
+ grpc_kick_fd_info *kfd;
grpc_pollset_kick_init(&state);
grpc_pollset_kick_kick(&state);
- fd = grpc_pollset_kick_pre_poll(&state);
- GPR_ASSERT(fd < 0);
+ kfd = grpc_pollset_kick_pre_poll(&state);
+ GPR_ASSERT(kfd == NULL);
grpc_pollset_kick_destroy(&state);
}
@@ -92,20 +92,19 @@ static void test_non_poll_kick(void) {
static void test_over_free(void) {
/* Check high watermark pipe free logic */
int i;
- struct grpc_pollset_kick_state *kick_state =
- gpr_malloc(sizeof(grpc_pollset_kick_state) * GRPC_MAX_CACHED_PIPES);
+ grpc_kick_fd_info **kfds =
+ gpr_malloc(sizeof(grpc_kick_fd_info*) * GRPC_MAX_CACHED_PIPES);
+ grpc_pollset_kick_state state;
+ grpc_pollset_kick_init(&state);
for (i = 0; i < GRPC_MAX_CACHED_PIPES; ++i) {
- int fd;
- grpc_pollset_kick_init(&kick_state[i]);
- fd = grpc_pollset_kick_pre_poll(&kick_state[i]);
- GPR_ASSERT(fd >= 0);
+ kfds[i] = grpc_pollset_kick_pre_poll(&state);
+ GPR_ASSERT(kfds[i] != NULL);
}
for (i = 0; i < GRPC_MAX_CACHED_PIPES; ++i) {
- grpc_pollset_kick_post_poll(&kick_state[i]);
- grpc_pollset_kick_destroy(&kick_state[i]);
+ grpc_pollset_kick_post_poll(&state, kfds[i]);
}
- gpr_free(kick_state);
+ grpc_pollset_kick_destroy(&state);
}
static void run_tests(void) {
diff --git a/vsprojects/grpc/grpc.vcxproj b/vsprojects/grpc/grpc.vcxproj
index b4c0cbd438..3b180c0050 100644
--- a/vsprojects/grpc/grpc.vcxproj
+++ b/vsprojects/grpc/grpc.vcxproj
@@ -194,9 +194,7 @@
<ClInclude Include="..\..\src\core\iomgr\iomgr_internal.h" />
<ClInclude Include="..\..\src\core\iomgr\iomgr_posix.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset.h" />
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_kick_posix.h" />
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick_windows.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_posix.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_set_posix.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_set_windows.h" />
@@ -349,7 +347,7 @@
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\iomgr_windows.c">
</ClCompile>
- <ClCompile Include="..\..\src\core\iomgr\pollset_kick.c">
+ <ClCompile Include="..\..\src\core\iomgr\pollset_kick_posix.c">
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\pollset_multipoller_with_epoll.c">
</ClCompile>
diff --git a/vsprojects/grpc/grpc.vcxproj.filters b/vsprojects/grpc/grpc.vcxproj.filters
index 7374de2dd7..ad4fd249fe 100644
--- a/vsprojects/grpc/grpc.vcxproj.filters
+++ b/vsprojects/grpc/grpc.vcxproj.filters
@@ -133,7 +133,7 @@
<ClCompile Include="..\..\src\core\iomgr\iomgr_windows.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\core\iomgr\pollset_kick.c">
+ <ClCompile Include="..\..\src\core\iomgr\pollset_kick_posix.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\pollset_multipoller_with_epoll.c">
@@ -500,15 +500,9 @@
<ClInclude Include="..\..\src\core\iomgr\pollset.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick.h">
- <Filter>src\core\iomgr</Filter>
- </ClInclude>
<ClInclude Include="..\..\src\core\iomgr\pollset_kick_posix.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick_windows.h">
- <Filter>src\core\iomgr</Filter>
- </ClInclude>
<ClInclude Include="..\..\src\core\iomgr\pollset_posix.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
diff --git a/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj
index 382ea93e2c..b7860bd6b2 100644
--- a/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj
+++ b/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj
@@ -176,9 +176,7 @@
<ClInclude Include="..\..\src\core\iomgr\iomgr_internal.h" />
<ClInclude Include="..\..\src\core\iomgr\iomgr_posix.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset.h" />
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_kick_posix.h" />
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick_windows.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_posix.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_set_posix.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_set_windows.h" />
@@ -291,7 +289,7 @@
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\iomgr_windows.c">
</ClCompile>
- <ClCompile Include="..\..\src\core\iomgr\pollset_kick.c">
+ <ClCompile Include="..\..\src\core\iomgr\pollset_kick_posix.c">
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\pollset_multipoller_with_epoll.c">
</ClCompile>
diff --git a/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters
index df865ca943..852dfdb34d 100644
--- a/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters
+++ b/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters
@@ -73,7 +73,7 @@
<ClCompile Include="..\..\src\core\iomgr\iomgr_windows.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\core\iomgr\pollset_kick.c">
+ <ClCompile Include="..\..\src\core\iomgr\pollset_kick_posix.c">
<Filter>src\core\iomgr</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\pollset_multipoller_with_epoll.c">
@@ -389,15 +389,9 @@
<ClInclude Include="..\..\src\core\iomgr\pollset.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick.h">
- <Filter>src\core\iomgr</Filter>
- </ClInclude>
<ClInclude Include="..\..\src\core\iomgr\pollset_kick_posix.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
- <ClInclude Include="..\..\src\core\iomgr\pollset_kick_windows.h">
- <Filter>src\core\iomgr</Filter>
- </ClInclude>
<ClInclude Include="..\..\src\core\iomgr\pollset_posix.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>