diff options
author | Yang Gao <yangg@google.com> | 2015-03-26 23:12:14 -0700 |
---|---|---|
committer | Yang Gao <yangg@google.com> | 2015-03-26 23:12:14 -0700 |
commit | 48bbd000eb9f7e4247446ef1d4f7f9dc26319550 (patch) | |
tree | 7d78f480b64cd6a73890ff0852b9bd725012154e /include | |
parent | 166f9d00cec5f74ef996dd3fec7025f2b031275c (diff) | |
parent | f9b6335b2c0c064903d26a631a6ee3ac19f37aa2 (diff) |
merge upstream and resolve conflict
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/completion_queue.h | 7 | ||||
-rw-r--r-- | include/grpc++/config.h | 22 | ||||
-rw-r--r-- | include/grpc++/server.h | 2 | ||||
-rw-r--r-- | include/grpc++/server_builder.h | 6 | ||||
-rw-r--r-- | include/grpc/support/atm_win32.h | 26 | ||||
-rw-r--r-- | include/grpc/support/cpu.h | 2 | ||||
-rw-r--r-- | include/grpc/support/port_platform.h | 9 |
7 files changed, 56 insertions, 18 deletions
diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index f4619a1060..e6a8c6fe55 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -36,6 +36,7 @@ #include <chrono> #include <grpc++/impl/client_unary_call.h> +#include <grpc/support/time.h> struct grpc_completion_queue; @@ -88,9 +89,7 @@ class CompletionQueue { // Returns false if the queue is ready for destruction, true if event bool Next(void** tag, bool* ok) { - return ( - AsyncNext(tag, ok, (std::chrono::system_clock::time_point::max)()) != - SHUTDOWN); + return (AsyncNextInternal(tag, ok, gpr_inf_future) != SHUTDOWN); } // Shutdown has to be called, and the CompletionQueue can only be @@ -122,6 +121,8 @@ class CompletionQueue { const grpc::protobuf::Message& request, grpc::protobuf::Message* result); + NextStatus AsyncNextInternal(void** tag, bool* ok, gpr_timespec deadline); + // Wraps grpc_completion_queue_pluck. // Cannot be mixed with calls to Next(). bool Pluck(CompletionQueueTag* tag); diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 35bf507364..8ef5d71bfa 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -65,6 +65,28 @@ ::google::protobuf::io::ZeroCopyInputStream #endif +#ifndef __clang__ +#ifdef __GNUC__ +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_NO_NULLPTR +#endif +#endif +#endif + +#ifdef GRPC_NO_NULLPTR +#include <memory> +const class { +public: + template <class T> operator T*() const {return static_cast<T *>(0);} + template <class T> operator std::unique_ptr<T>() const { + return std::unique_ptr<T>(static_cast<T *>(0)); + } + operator bool() const {return false;} +private: + void operator&() const = delete; +} nullptr = {}; +#endif + namespace grpc { typedef GRPC_CUSTOM_STRING string; diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 8cd0a4f668..bddb4f62aa 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -86,7 +86,7 @@ class Server GRPC_FINAL : private CallHook, bool RegisterAsyncService(AsynchronousService* service); void RegisterAsyncGenericService(AsyncGenericService* service); // Add a listening port. Can be called multiple times. - int AddPort(const grpc::string& addr, ServerCredentials* creds); + int AddListeningPort(const grpc::string& addr, ServerCredentials* creds); // Start the server. bool Start(); diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index c09c8fee52..9a9932ebe0 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -69,9 +69,9 @@ class ServerBuilder { void RegisterAsyncGenericService(AsyncGenericService* service); // Add a listening port. Can be called multiple times. - void AddPort(const grpc::string& addr, - std::shared_ptr<ServerCredentials> creds, - int* selected_port = nullptr); + void AddListeningPort(const grpc::string& addr, + std::shared_ptr<ServerCredentials> creds, + int* selected_port = nullptr); // Set the thread pool used for running appliation rpc handlers. // Does not take ownership. diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index 8b5322488e..4a21b5b547 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -63,25 +63,31 @@ static __inline int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { /* InterlockedCompareExchangePointerNoFence() not available on vista or windows7 */ #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeAcquire64(p, n, o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG *) p, + (LONGLONG) n, (LONGLONG) o); #else - return o == (gpr_atm)InterlockedCompareExchangeAcquire(p, n, o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *) p, + (LONG) n, (LONG) o); #endif } static __inline int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeAcquire64(p, n, o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG) p, + (LONGLONG) n, (LONGLONG) o); #else - return o == (gpr_atm)InterlockedCompareExchangeAcquire(p, n, o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *) p, + (LONG) n, (LONG) o); #endif } static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeRelease64(p, n, o); + return o == (gpr_atm)InterlockedCompareExchangeRelease64((volatile LONGLONG *) p, + (LONGLONG) n, (LONGLONG) o); #else - return o == (gpr_atm)InterlockedCompareExchangeRelease(p, n, o); + return o == (gpr_atm)InterlockedCompareExchangeRelease((volatile LONG *) p, + (LONG) n, (LONG) o); #endif } @@ -101,11 +107,15 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) { #ifdef GPR_ARCH_64 do { old = *p; - } while (old != (gpr_atm)InterlockedCompareExchange64(p, old + delta, old)); + } while (old != (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG *) p, + (LONGLONG) old + delta, + (LONGLONG) old)); #else do { old = *p; - } while (old != (gpr_atm)InterlockedCompareExchange(p, old + delta, old)); + } while (old != (gpr_atm)InterlockedCompareExchange((volatile LONG *) p, + (LONG) old + delta, + (LONG) old)); #endif return old; } diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index 005c3c721c..2b2a56168a 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -41,7 +41,7 @@ extern "C" { /* Interface providing CPU information for currently running system */ /* Return the number of CPU cores on the current system. Will return 0 if - if information is not available. */ + the information is not available. */ unsigned gpr_cpu_num_cores(void); /* Return the CPU on which the current thread is executing; N.B. This should diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 1b613dc2fd..9b639cf82d 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -124,10 +124,15 @@ #define GPR_ARCH_32 1 #endif /* _LP64 */ #elif defined(__APPLE__) +#include <TargetConditionals.h> #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif +#if TARGET_OS_IPHONE +#define GPR_CPU_IPHONE 1 +#else /* TARGET_OS_IPHONE */ #define GPR_CPU_POSIX 1 +#endif #define GPR_GCC_ATOMIC 1 #define GPR_POSIX_LOG 1 #define GPR_POSIX_MULTIPOLL_WITH_POLL 1 @@ -185,8 +190,8 @@ #error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64 #endif -#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) != 1 -#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32 +#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + defined(GPR_CPU_IPHONE) != 1 +#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32, GPR_CPU_IPHONE #endif #if defined(GPR_POSIX_MULTIPOLL_WITH_POLL) && !defined(GPR_POSIX_SOCKET) |