diff --git a/Makefile b/Makefile index bb7f613eefa..763d340bba6 100644 --- a/Makefile +++ b/Makefile @@ -1405,10 +1405,10 @@ LIBGRPC_SRC = \ src/core/iomgr/tcp_posix.c \ src/core/iomgr/tcp_server_posix.c \ src/core/iomgr/time_averaged_stats.c \ - src/core/iomgr/wakeup_fd.c \ src/core/iomgr/wakeup_fd_eventfd.c \ src/core/iomgr/wakeup_fd_nospecial.c \ src/core/iomgr/wakeup_fd_pipe.c \ + src/core/iomgr/wakeup_fd_posix.c \ src/core/statistics/census_init.c \ src/core/statistics/census_log.c \ src/core/statistics/census_rpc_stats.c \ @@ -1528,10 +1528,10 @@ src/core/iomgr/tcp_client_posix.c: $(OPENSSL_DEP) src/core/iomgr/tcp_posix.c: $(OPENSSL_DEP) src/core/iomgr/tcp_server_posix.c: $(OPENSSL_DEP) src/core/iomgr/time_averaged_stats.c: $(OPENSSL_DEP) -src/core/iomgr/wakeup_fd.c: $(OPENSSL_DEP) src/core/iomgr/wakeup_fd_eventfd.c: $(OPENSSL_DEP) src/core/iomgr/wakeup_fd_nospecial.c: $(OPENSSL_DEP) src/core/iomgr/wakeup_fd_pipe.c: $(OPENSSL_DEP) +src/core/iomgr/wakeup_fd_posix.c: $(OPENSSL_DEP) src/core/statistics/census_init.c: $(OPENSSL_DEP) src/core/statistics/census_log.c: $(OPENSSL_DEP) src/core/statistics/census_rpc_stats.c: $(OPENSSL_DEP) @@ -1672,10 +1672,10 @@ objs/$(CONFIG)/src/core/iomgr/tcp_client_posix.o: objs/$(CONFIG)/src/core/iomgr/tcp_posix.o: objs/$(CONFIG)/src/core/iomgr/tcp_server_posix.o: objs/$(CONFIG)/src/core/iomgr/time_averaged_stats.o: -objs/$(CONFIG)/src/core/iomgr/wakeup_fd.o: objs/$(CONFIG)/src/core/iomgr/wakeup_fd_eventfd.o: objs/$(CONFIG)/src/core/iomgr/wakeup_fd_nospecial.o: objs/$(CONFIG)/src/core/iomgr/wakeup_fd_pipe.o: +objs/$(CONFIG)/src/core/iomgr/wakeup_fd_posix.o: objs/$(CONFIG)/src/core/statistics/census_init.o: objs/$(CONFIG)/src/core/statistics/census_log.o: objs/$(CONFIG)/src/core/statistics/census_rpc_stats.o: @@ -1836,10 +1836,10 @@ LIBGRPC_UNSECURE_SRC = \ src/core/iomgr/tcp_posix.c \ src/core/iomgr/tcp_server_posix.c \ src/core/iomgr/time_averaged_stats.c \ - src/core/iomgr/wakeup_fd.c \ src/core/iomgr/wakeup_fd_eventfd.c \ src/core/iomgr/wakeup_fd_nospecial.c \ src/core/iomgr/wakeup_fd_pipe.c \ + src/core/iomgr/wakeup_fd_posix.c \ src/core/statistics/census_init.c \ src/core/statistics/census_log.c \ src/core/statistics/census_rpc_stats.c \ @@ -1963,10 +1963,10 @@ objs/$(CONFIG)/src/core/iomgr/tcp_client_posix.o: objs/$(CONFIG)/src/core/iomgr/tcp_posix.o: objs/$(CONFIG)/src/core/iomgr/tcp_server_posix.o: objs/$(CONFIG)/src/core/iomgr/time_averaged_stats.o: -objs/$(CONFIG)/src/core/iomgr/wakeup_fd.o: objs/$(CONFIG)/src/core/iomgr/wakeup_fd_eventfd.o: objs/$(CONFIG)/src/core/iomgr/wakeup_fd_nospecial.o: objs/$(CONFIG)/src/core/iomgr/wakeup_fd_pipe.o: +objs/$(CONFIG)/src/core/iomgr/wakeup_fd_posix.o: objs/$(CONFIG)/src/core/statistics/census_init.o: objs/$(CONFIG)/src/core/statistics/census_log.o: objs/$(CONFIG)/src/core/statistics/census_rpc_stats.o: diff --git a/build.json b/build.json index bd3f26dd0a4..85973d3eeaf 100644 --- a/build.json +++ b/build.json @@ -47,6 +47,8 @@ "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_windows.h", "src/core/iomgr/resolve_address.h", @@ -59,7 +61,8 @@ "src/core/iomgr/tcp_posix.h", "src/core/iomgr/tcp_server.h", "src/core/iomgr/time_averaged_stats.h", - "src/core/iomgr/wakeup_fd.h", + "src/core/iomgr/wakeup_fd_posix.h", + "src/core/iomgr/wakeup_fd_pipe.h", "src/core/statistics/census_interface.h", "src/core/statistics/census_log.h", "src/core/statistics/census_rpc_stats.h", @@ -137,10 +140,10 @@ "src/core/iomgr/tcp_posix.c", "src/core/iomgr/tcp_server_posix.c", "src/core/iomgr/time_averaged_stats.c", - "src/core/iomgr/wakeup_fd.c", "src/core/iomgr/wakeup_fd_eventfd.c", "src/core/iomgr/wakeup_fd_nospecial.c", "src/core/iomgr/wakeup_fd_pipe.c", + "src/core/iomgr/wakeup_fd_posix.c", "src/core/statistics/census_init.c", "src/core/statistics/census_log.c", "src/core/statistics/census_rpc_stats.c", diff --git a/src/core/iomgr/pollset_kick.c b/src/core/iomgr/pollset_kick.c index 9158f9077ca..e4a9caf97a6 100644 --- a/src/core/iomgr/pollset_kick.c +++ b/src/core/iomgr/pollset_kick.c @@ -41,7 +41,7 @@ #include #include "src/core/iomgr/socket_utils_posix.h" -#include "src/core/iomgr/wakeup_fd.h" +#include "src/core/iomgr/wakeup_fd_posix.h" #include #include diff --git a/src/core/iomgr/pollset_kick.h b/src/core/iomgr/pollset_kick.h index 5e909312611..b224177d317 100644 --- a/src/core/iomgr/pollset_kick.h +++ b/src/core/iomgr/pollset_kick.h @@ -34,22 +34,18 @@ #ifndef __GRPC_INTERNAL_IOMGR_POLLSET_KICK_H_ #define __GRPC_INTERNAL_IOMGR_POLLSET_KICK_H_ -#include "src/core/iomgr/wakeup_fd.h" -#include +#include -/* This is an abstraction around the typical pipe mechanism for waking up a - thread sitting in a poll() style call. */ +#ifdef GPR_POSIX_SOCKET +#include "src/core/iomgr/pollset_kick_posix.h" +#endif -typedef struct grpc_kick_fd_info { - grpc_wakeup_fd_info wakeup_fd; - struct grpc_kick_fd_info *next; -} grpc_kick_fd_info; +#ifdef GPR_WIN32 +#include "src/core/iomgr/pollset_kick_windows.h" +#endif -typedef struct grpc_pollset_kick_state { - gpr_mu mu; - int kicked; - struct grpc_kick_fd_info *fd_info; -} grpc_pollset_kick_state; +/* 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); diff --git a/src/core/iomgr/pollset_kick_posix.h b/src/core/iomgr/pollset_kick_posix.h new file mode 100644 index 00000000000..162ae5bd8f1 --- /dev/null +++ b/src/core/iomgr/pollset_kick_posix.h @@ -0,0 +1,51 @@ +/* + * + * 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_IOMGR_POLLSET_KICK_POSIX_H_ +#define __GRPC_INTERNAL_IOMGR_POLLSET_KICK_POSIX_H_ + +#include "src/core/iomgr/wakeup_fd_posix.h" +#include + +typedef struct grpc_kick_fd_info { + grpc_wakeup_fd_info wakeup_fd; + struct grpc_kick_fd_info *next; +} grpc_kick_fd_info; + +typedef struct grpc_pollset_kick_state { + gpr_mu mu; + int kicked; + struct grpc_kick_fd_info *fd_info; +} grpc_pollset_kick_state; + +#endif /* __GRPC_INTERNALIOMGR_POLLSET_KICK_POSIX_H_ */ diff --git a/src/core/iomgr/pollset_kick_windows.h b/src/core/iomgr/pollset_kick_windows.h new file mode 100644 index 00000000000..1053230a983 --- /dev/null +++ b/src/core/iomgr/pollset_kick_windows.h @@ -0,0 +1,45 @@ +/* + * + * 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_IOMGR_POLLSET_KICK_WINDOWS_H_ +#define __GRPC_INTERNAL_IOMGR_POLLSET_KICK_WINDOWS_H_ + +#include + +struct grpc_kick_fd_info; + +typedef struct grpc_pollset_kick_state { + int unused; +} grpc_pollset_kick_state; + +#endif /* __GRPC_INTERNALIOMGR_POLLSET_KICK_WINDOWS_H_ */ diff --git a/src/core/iomgr/wakeup_fd_eventfd.c b/src/core/iomgr/wakeup_fd_eventfd.c index 4c495e675a6..3ee7f941285 100644 --- a/src/core/iomgr/wakeup_fd_eventfd.c +++ b/src/core/iomgr/wakeup_fd_eventfd.c @@ -39,7 +39,7 @@ #include #include -#include "src/core/iomgr/wakeup_fd.h" +#include "src/core/iomgr/wakeup_fd_posix.h" #include static void eventfd_create(grpc_wakeup_fd_info *fd_info) { diff --git a/src/core/iomgr/wakeup_fd_pipe.c b/src/core/iomgr/wakeup_fd_pipe.c index f8a0aeb606c..f36e6eeb9f5 100644 --- a/src/core/iomgr/wakeup_fd_pipe.c +++ b/src/core/iomgr/wakeup_fd_pipe.c @@ -32,7 +32,7 @@ */ /* TODO(klempner): Allow this code to be disabled. */ -#include "src/core/iomgr/wakeup_fd.h" +#include "src/core/iomgr/wakeup_fd_posix.h" #include #include diff --git a/src/core/iomgr/wakeup_fd_pipe.h b/src/core/iomgr/wakeup_fd_pipe.h index 8e2ed85885b..fc2898f570e 100644 --- a/src/core/iomgr/wakeup_fd_pipe.h +++ b/src/core/iomgr/wakeup_fd_pipe.h @@ -34,7 +34,7 @@ #ifndef __GRPC_INTERNAL_IOMGR_WAKEUP_FD_PIPE_H_ #define __GRPC_INTERNAL_IOMGR_WAKEUP_FD_PIPE_H_ -#include "src/core/iomgr/wakeup_fd.h" +#include "src/core/iomgr/wakeup_fd_posix.h" extern grpc_wakeup_fd_vtable pipe_wakeup_fd_vtable; diff --git a/src/core/iomgr/wakeup_fd.c b/src/core/iomgr/wakeup_fd_posix.c similarity index 98% rename from src/core/iomgr/wakeup_fd.c rename to src/core/iomgr/wakeup_fd_posix.c index b81707f2a02..9107cf37b1e 100644 --- a/src/core/iomgr/wakeup_fd.c +++ b/src/core/iomgr/wakeup_fd_posix.c @@ -31,7 +31,7 @@ * */ -#include "src/core/iomgr/wakeup_fd.h" +#include "src/core/iomgr/wakeup_fd_posix.h" #include "src/core/iomgr/wakeup_fd_pipe.h" #include diff --git a/src/core/iomgr/wakeup_fd.h b/src/core/iomgr/wakeup_fd_posix.h similarity index 96% rename from src/core/iomgr/wakeup_fd.h rename to src/core/iomgr/wakeup_fd_posix.h index 225291ca601..2d785976b33 100644 --- a/src/core/iomgr/wakeup_fd.h +++ b/src/core/iomgr/wakeup_fd_posix.h @@ -59,8 +59,8 @@ * 2. If the polling thread was awakened by a wakeup_fd event, call * grpc_wakeup_fd_consume_wakeup() on it. */ -#ifndef __GRPC_INTERNAL_IOMGR_WAKEUP_FD_H_ -#define __GRPC_INTERNAL_IOMGR_WAKEUP_FD_H_ +#ifndef __GRPC_INTERNAL_IOMGR_WAKEUP_FD_POSIX_H_ +#define __GRPC_INTERNAL_IOMGR_WAKEUP_FD_POSIX_H_ typedef struct grpc_wakeup_fd_info grpc_wakeup_fd_info; @@ -99,4 +99,4 @@ typedef struct grpc_wakeup_fd_vtable { * wakeup_fd_nospecial.c if no such implementation exists. */ extern const grpc_wakeup_fd_vtable specialized_wakeup_fd_vtable; -#endif /* __GRPC_INTERNAL_IOMGR_WAKEUP_FD_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_WAKEUP_FD_POSIX_H_ */ diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index 1f2f30d6be1..9808a451bb9 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -120,6 +120,8 @@ + + @@ -132,7 +134,8 @@ - + + @@ -275,14 +278,14 @@ - - + + diff --git a/vsprojects/vs2013/grpc.vcxproj.filters b/vsprojects/vs2013/grpc.vcxproj.filters index 36971604dfd..d080ce986d7 100644 --- a/vsprojects/vs2013/grpc.vcxproj.filters +++ b/vsprojects/vs2013/grpc.vcxproj.filters @@ -157,9 +157,6 @@ src\core\iomgr - - src\core\iomgr - src\core\iomgr @@ -169,6 +166,9 @@ src\core\iomgr + + src\core\iomgr + src\core\statistics @@ -434,6 +434,12 @@ src\core\iomgr + + src\core\iomgr + + + src\core\iomgr + src\core\iomgr @@ -470,7 +476,10 @@ src\core\iomgr - + + src\core\iomgr + + src\core\iomgr diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index 1f2f30d6be1..9808a451bb9 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -120,6 +120,8 @@ + + @@ -132,7 +134,8 @@ - + + @@ -275,14 +278,14 @@ - - + + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters index 4d3bbd92554..5b12fabf6e9 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters @@ -118,9 +118,6 @@ src\core\iomgr - - src\core\iomgr - src\core\iomgr @@ -130,6 +127,9 @@ src\core\iomgr + + src\core\iomgr + src\core\statistics @@ -359,6 +359,12 @@ src\core\iomgr + + src\core\iomgr + + + src\core\iomgr + src\core\iomgr @@ -395,7 +401,10 @@ src\core\iomgr - + + src\core\iomgr + + src\core\iomgr