create
This commit is contained in:
52
Pods/gRPC-Core/include/grpc/support/alloc.h
generated
Normal file
52
Pods/gRPC-Core/include/grpc/support/alloc.h
generated
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_ALLOC_H
|
||||
#define GRPC_SUPPORT_ALLOC_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** malloc.
|
||||
* If size==0, always returns NULL. Otherwise this function never returns NULL.
|
||||
* The pointer returned is suitably aligned for any kind of variable it could
|
||||
* contain.
|
||||
*/
|
||||
GPRAPI void* gpr_malloc(size_t size);
|
||||
/** like malloc, but zero all bytes before returning them */
|
||||
GPRAPI void* gpr_zalloc(size_t size);
|
||||
/** free */
|
||||
GPRAPI void gpr_free(void* ptr);
|
||||
/** realloc, never returns NULL */
|
||||
GPRAPI void* gpr_realloc(void* p, size_t size);
|
||||
/** aligned malloc, never returns NULL, will align to alignment, which
|
||||
* must be a power of 2. */
|
||||
GPRAPI void* gpr_malloc_aligned(size_t size, size_t alignment);
|
||||
/** free memory allocated by gpr_malloc_aligned */
|
||||
GPRAPI void gpr_free_aligned(void* ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_ALLOC_H */
|
||||
95
Pods/gRPC-Core/include/grpc/support/atm.h
generated
Normal file
95
Pods/gRPC-Core/include/grpc/support/atm.h
generated
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_ATM_H
|
||||
#define GRPC_SUPPORT_ATM_H
|
||||
|
||||
/** This interface provides atomic operations and barriers.
|
||||
It is internal to gpr support code and should not be used outside it.
|
||||
|
||||
If an operation with acquire semantics precedes another memory access by the
|
||||
same thread, the operation will precede that other access as seen by other
|
||||
threads.
|
||||
|
||||
If an operation with release semantics follows another memory access by the
|
||||
same thread, the operation will follow that other access as seen by other
|
||||
threads.
|
||||
|
||||
Routines with "acq" or "full" in the name have acquire semantics. Routines
|
||||
with "rel" or "full" in the name have release semantics. Routines with
|
||||
"no_barrier" in the name have neither acquire not release semantics.
|
||||
|
||||
The routines may be implemented as macros.
|
||||
|
||||
// Atomic operations act on an integral_type gpr_atm that is guaranteed to
|
||||
// be the same size as a pointer.
|
||||
typedef intptr_t gpr_atm;
|
||||
|
||||
// A memory barrier, providing both acquire and release semantics, but not
|
||||
// otherwise acting on memory.
|
||||
void gpr_atm_full_barrier(void);
|
||||
|
||||
// Atomically return *p, with acquire semantics.
|
||||
gpr_atm gpr_atm_acq_load(gpr_atm *p);
|
||||
gpr_atm gpr_atm_no_barrier_load(gpr_atm *p);
|
||||
|
||||
// Atomically set *p = value, with release semantics.
|
||||
void gpr_atm_rel_store(gpr_atm *p, gpr_atm value);
|
||||
|
||||
// Atomically add delta to *p, and return the old value of *p, with
|
||||
// the barriers specified.
|
||||
gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm *p, gpr_atm delta);
|
||||
gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta);
|
||||
|
||||
// Atomically, if *p==o, set *p=n and return non-zero otherwise return 0,
|
||||
// with the barriers specified if the operation succeeds.
|
||||
int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
|
||||
int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
|
||||
int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
|
||||
int gpr_atm_full_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
|
||||
|
||||
// Atomically, set *p=n and return the old value of *p
|
||||
gpr_atm gpr_atm_full_xchg(gpr_atm *p, gpr_atm n);
|
||||
*/
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#if defined(GPR_GCC_ATOMIC)
|
||||
#include <grpc/support/atm_gcc_atomic.h> // IWYU pragma: export
|
||||
#elif defined(GPR_GCC_SYNC)
|
||||
#include <grpc/support/atm_gcc_sync.h> // IWYU pragma: export
|
||||
#elif defined(GPR_WINDOWS_ATOMIC)
|
||||
#include <grpc/support/atm_windows.h> // IWYU pragma: export
|
||||
#else
|
||||
#error could not determine platform for atm
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Adds \a delta to \a *value, clamping the result to the range specified
|
||||
by \a min and \a max. Returns the new value. */
|
||||
gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta,
|
||||
gpr_atm min, gpr_atm max);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_ATM_H */
|
||||
84
Pods/gRPC-Core/include/grpc/support/atm_gcc_atomic.h
generated
Normal file
84
Pods/gRPC-Core/include/grpc/support/atm_gcc_atomic.h
generated
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H
|
||||
#define GRPC_SUPPORT_ATM_GCC_ATOMIC_H
|
||||
|
||||
// IWYU pragma: private, include <grpc/support/atm.h>
|
||||
|
||||
/* atm_platform.h for gcc and gcc-like compilers with the
|
||||
__atomic_* interface. */
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef intptr_t gpr_atm;
|
||||
#define GPR_ATM_MAX INTPTR_MAX
|
||||
#define GPR_ATM_MIN INTPTR_MIN
|
||||
|
||||
#define gpr_atm_full_barrier() (__atomic_thread_fence(__ATOMIC_SEQ_CST))
|
||||
|
||||
#define gpr_atm_acq_load(p) (__atomic_load_n((p), __ATOMIC_ACQUIRE))
|
||||
#define gpr_atm_no_barrier_load(p) (__atomic_load_n((p), __ATOMIC_RELAXED))
|
||||
#define gpr_atm_rel_store(p, value) \
|
||||
(__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELEASE))
|
||||
#define gpr_atm_no_barrier_store(p, value) \
|
||||
(__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELAXED))
|
||||
|
||||
#define gpr_atm_no_barrier_fetch_add(p, delta) \
|
||||
__atomic_fetch_add((p), (intptr_t)(delta), __ATOMIC_RELAXED)
|
||||
#define gpr_atm_full_fetch_add(p, delta) \
|
||||
__atomic_fetch_add((p), (intptr_t)(delta), __ATOMIC_ACQ_REL)
|
||||
|
||||
static __inline int gpr_atm_no_barrier_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
|
||||
// Need to be c89 compatible, so we can't use false for the fourth argument.
|
||||
// NOLINTNEXTLINE(modernize-use-bool-literals)
|
||||
return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_RELAXED,
|
||||
__ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static __inline int gpr_atm_acq_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
|
||||
// Need to be c89 compatible, so we can't use false for the fourth argument.
|
||||
// NOLINTNEXTLINE(modernize-use-bool-literals)
|
||||
return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_ACQUIRE,
|
||||
__ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static __inline int gpr_atm_rel_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
|
||||
// Need to be c89 compatible, so we can't use false for the fourth argument.
|
||||
// NOLINTNEXTLINE(modernize-use-bool-literals)
|
||||
return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_RELEASE,
|
||||
__ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
|
||||
// Need to be c89 compatible, so we can't use false for the fourth argument.
|
||||
// NOLINTNEXTLINE(modernize-use-bool-literals)
|
||||
return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_ACQ_REL,
|
||||
__ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
#define gpr_atm_full_xchg(p, n) __atomic_exchange_n((p), (n), __ATOMIC_ACQ_REL)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */
|
||||
83
Pods/gRPC-Core/include/grpc/support/atm_gcc_sync.h
generated
Normal file
83
Pods/gRPC-Core/include/grpc/support/atm_gcc_sync.h
generated
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_ATM_GCC_SYNC_H
|
||||
#define GRPC_SUPPORT_ATM_GCC_SYNC_H
|
||||
|
||||
/* variant of atm_platform.h for gcc and gcc-like compilers with __sync_*
|
||||
interface */
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
typedef intptr_t gpr_atm;
|
||||
#define GPR_ATM_MAX INTPTR_MAX
|
||||
#define GPR_ATM_MIN INTPTR_MIN
|
||||
|
||||
#define GPR_ATM_COMPILE_BARRIER_() __asm__ __volatile__("" : : : "memory")
|
||||
|
||||
#if defined(__i386) || defined(__x86_64__)
|
||||
/* All loads are acquire loads and all stores are release stores. */
|
||||
#define GPR_ATM_LS_BARRIER_() GPR_ATM_COMPILE_BARRIER_()
|
||||
#else
|
||||
#define GPR_ATM_LS_BARRIER_() gpr_atm_full_barrier()
|
||||
#endif
|
||||
|
||||
#define gpr_atm_full_barrier() (__sync_synchronize())
|
||||
|
||||
static __inline gpr_atm gpr_atm_acq_load(const gpr_atm* p) {
|
||||
gpr_atm value = *p;
|
||||
GPR_ATM_LS_BARRIER_();
|
||||
return value;
|
||||
}
|
||||
|
||||
static __inline gpr_atm gpr_atm_no_barrier_load(const gpr_atm* p) {
|
||||
gpr_atm value = *p;
|
||||
GPR_ATM_COMPILE_BARRIER_();
|
||||
return value;
|
||||
}
|
||||
|
||||
static __inline void gpr_atm_rel_store(gpr_atm* p, gpr_atm value) {
|
||||
GPR_ATM_LS_BARRIER_();
|
||||
*p = value;
|
||||
}
|
||||
|
||||
static __inline void gpr_atm_no_barrier_store(gpr_atm* p, gpr_atm value) {
|
||||
GPR_ATM_COMPILE_BARRIER_();
|
||||
*p = value;
|
||||
}
|
||||
|
||||
#undef GPR_ATM_LS_BARRIER_
|
||||
#undef GPR_ATM_COMPILE_BARRIER_
|
||||
|
||||
#define gpr_atm_no_barrier_fetch_add(p, delta) \
|
||||
gpr_atm_full_fetch_add((p), (delta))
|
||||
#define gpr_atm_full_fetch_add(p, delta) (__sync_fetch_and_add((p), (delta)))
|
||||
|
||||
#define gpr_atm_no_barrier_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
|
||||
#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
|
||||
#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
|
||||
#define gpr_atm_full_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
|
||||
|
||||
static __inline gpr_atm gpr_atm_full_xchg(gpr_atm* p, gpr_atm n) {
|
||||
gpr_atm cur;
|
||||
do {
|
||||
cur = gpr_atm_acq_load(p);
|
||||
} while (!gpr_atm_rel_cas(p, cur, n));
|
||||
return cur;
|
||||
}
|
||||
|
||||
#endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */
|
||||
130
Pods/gRPC-Core/include/grpc/support/atm_windows.h
generated
Normal file
130
Pods/gRPC-Core/include/grpc/support/atm_windows.h
generated
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_ATM_WINDOWS_H
|
||||
#define GRPC_SUPPORT_ATM_WINDOWS_H
|
||||
|
||||
/** Win32 variant of atm_platform.h */
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#ifdef GPR_WINDOWS
|
||||
|
||||
typedef intptr_t gpr_atm;
|
||||
#define GPR_ATM_MAX INTPTR_MAX
|
||||
#define GPR_ATM_MIN INTPTR_MIN
|
||||
|
||||
#define gpr_atm_full_barrier MemoryBarrier
|
||||
|
||||
static __inline gpr_atm gpr_atm_acq_load(const gpr_atm* p) {
|
||||
gpr_atm result = *p;
|
||||
gpr_atm_full_barrier();
|
||||
return result;
|
||||
}
|
||||
|
||||
static __inline gpr_atm gpr_atm_no_barrier_load(const gpr_atm* p) {
|
||||
/* TODO(dklempner): Can we implement something better here? */
|
||||
return gpr_atm_acq_load(p);
|
||||
}
|
||||
|
||||
static __inline void gpr_atm_rel_store(gpr_atm* p, gpr_atm value) {
|
||||
gpr_atm_full_barrier();
|
||||
*p = value;
|
||||
}
|
||||
|
||||
static __inline void gpr_atm_no_barrier_store(gpr_atm* p, gpr_atm value) {
|
||||
/* TODO(ctiller): Can we implement something better here? */
|
||||
gpr_atm_rel_store(p, value);
|
||||
}
|
||||
|
||||
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(
|
||||
(volatile LONGLONG*)p, (LONGLONG)n, (LONGLONG)o);
|
||||
#else
|
||||
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(
|
||||
(volatile LONGLONG*)p, (LONGLONG)n, (LONGLONG)o);
|
||||
#else
|
||||
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(
|
||||
(volatile LONGLONG*)p, (LONGLONG)n, (LONGLONG)o);
|
||||
#else
|
||||
return o == (gpr_atm)InterlockedCompareExchangeRelease((volatile LONG*)p,
|
||||
(LONG)n, (LONG)o);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) {
|
||||
#ifdef GPR_ARCH_64
|
||||
return o == (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG*)p,
|
||||
(LONGLONG)n, (LONGLONG)o);
|
||||
#else
|
||||
return o == (gpr_atm)InterlockedCompareExchange((volatile LONG*)p, (LONG)n,
|
||||
(LONG)o);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm* p,
|
||||
gpr_atm delta) {
|
||||
/** Use the CAS operation to get pointer-sized fetch and add */
|
||||
gpr_atm old;
|
||||
do {
|
||||
old = *p;
|
||||
} while (!gpr_atm_no_barrier_cas(p, old, old + delta));
|
||||
return old;
|
||||
}
|
||||
|
||||
static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm* p, gpr_atm delta) {
|
||||
/** Use a CAS operation to get pointer-sized fetch and add */
|
||||
gpr_atm old;
|
||||
#ifdef GPR_ARCH_64
|
||||
do {
|
||||
old = *p;
|
||||
} while (old != (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG*)p,
|
||||
(LONGLONG)old + delta,
|
||||
(LONGLONG)old));
|
||||
#else
|
||||
do {
|
||||
old = *p;
|
||||
} while (old != (gpr_atm)InterlockedCompareExchange(
|
||||
(volatile LONG*)p, (LONG)old + delta, (LONG)old));
|
||||
#endif
|
||||
return old;
|
||||
}
|
||||
|
||||
static __inline gpr_atm gpr_atm_full_xchg(gpr_atm* p, gpr_atm n) {
|
||||
return (gpr_atm)InterlockedExchangePointer((PVOID*)p, (PVOID)n);
|
||||
}
|
||||
|
||||
#endif /* GPR_WINDOWS */
|
||||
|
||||
#endif /* GRPC_SUPPORT_ATM_WINDOWS_H */
|
||||
44
Pods/gRPC-Core/include/grpc/support/cpu.h
generated
Normal file
44
Pods/gRPC-Core/include/grpc/support/cpu.h
generated
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_CPU_H
|
||||
#define GRPC_SUPPORT_CPU_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Interface providing CPU information for currently running system */
|
||||
|
||||
/** Return the number of CPU cores on the current system. Will return 0 if
|
||||
the information is not available. */
|
||||
GPRAPI unsigned gpr_cpu_num_cores(void);
|
||||
|
||||
/** Return the CPU on which the current thread is executing; N.B. This should
|
||||
be considered advisory only - it is possible that the thread is switched
|
||||
to a different CPU at any time. Returns a value in range
|
||||
[0, gpr_cpu_num_cores() - 1] */
|
||||
GPRAPI unsigned gpr_cpu_current_cpu(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_CPU_H */
|
||||
218
Pods/gRPC-Core/include/grpc/support/json.h
generated
Normal file
218
Pods/gRPC-Core/include/grpc/support/json.h
generated
Normal file
@@ -0,0 +1,218 @@
|
||||
//
|
||||
// Copyright 2015 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#ifndef GRPC_SUPPORT_JSON_H
|
||||
#define GRPC_SUPPORT_JSON_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/types/variant.h"
|
||||
|
||||
namespace grpc_core {
|
||||
namespace experimental {
|
||||
|
||||
// A JSON value, which can be any one of null, boolean, number, string,
|
||||
// object, or array.
|
||||
class Json {
|
||||
public:
|
||||
// The JSON type.
|
||||
enum class Type {
|
||||
kNull, // No payload. Default type when using the zero-arg ctor.
|
||||
kBoolean, // Use boolean() for payload.
|
||||
kNumber, // Numbers are stored in string form to avoid precision
|
||||
// and integer capacity issues. Use string() for payload.
|
||||
kString, // Use string() for payload.
|
||||
kObject, // Use object() for payload.
|
||||
kArray, // Use array() for payload.
|
||||
};
|
||||
|
||||
using Object = std::map<std::string, Json>;
|
||||
using Array = std::vector<Json>;
|
||||
|
||||
// Factory method for kBoolean.
|
||||
static Json FromBool(bool b) {
|
||||
Json json;
|
||||
json.value_ = b;
|
||||
return json;
|
||||
}
|
||||
|
||||
// Factory methods for kNumber.
|
||||
static Json FromNumber(const std::string& str) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{str};
|
||||
return json;
|
||||
}
|
||||
static Json FromNumber(const char* str) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{std::string(str)};
|
||||
return json;
|
||||
}
|
||||
static Json FromNumber(std::string&& str) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{std::move(str)};
|
||||
return json;
|
||||
}
|
||||
static Json FromNumber(int32_t value) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{absl::StrCat(value)};
|
||||
return json;
|
||||
}
|
||||
static Json FromNumber(uint32_t value) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{absl::StrCat(value)};
|
||||
return json;
|
||||
}
|
||||
static Json FromNumber(int64_t value) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{absl::StrCat(value)};
|
||||
return json;
|
||||
}
|
||||
static Json FromNumber(uint64_t value) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{absl::StrCat(value)};
|
||||
return json;
|
||||
}
|
||||
static Json FromNumber(double value) {
|
||||
Json json;
|
||||
json.value_ = NumberValue{absl::StrCat(value)};
|
||||
return json;
|
||||
}
|
||||
|
||||
// Factory methods for kString.
|
||||
static Json FromString(const std::string& str) {
|
||||
Json json;
|
||||
json.value_ = str;
|
||||
return json;
|
||||
}
|
||||
static Json FromString(const char* str) {
|
||||
Json json;
|
||||
json.value_ = std::string(str);
|
||||
return json;
|
||||
}
|
||||
static Json FromString(std::string&& str) {
|
||||
Json json;
|
||||
json.value_ = std::move(str);
|
||||
return json;
|
||||
}
|
||||
|
||||
// Factory methods for kObject.
|
||||
static Json FromObject(const Object& object) {
|
||||
Json json;
|
||||
json.value_ = object;
|
||||
return json;
|
||||
}
|
||||
static Json FromObject(Object&& object) {
|
||||
Json json;
|
||||
json.value_ = std::move(object);
|
||||
return json;
|
||||
}
|
||||
|
||||
// Factory methods for kArray.
|
||||
static Json FromArray(const Array& array) {
|
||||
Json json;
|
||||
json.value_ = array;
|
||||
return json;
|
||||
}
|
||||
static Json FromArray(Array&& array) {
|
||||
Json json;
|
||||
json.value_ = std::move(array);
|
||||
return json;
|
||||
}
|
||||
|
||||
Json() = default;
|
||||
|
||||
// Copyable.
|
||||
Json(const Json& other) = default;
|
||||
Json& operator=(const Json& other) = default;
|
||||
|
||||
// Moveable.
|
||||
Json(Json&& other) noexcept : value_(std::move(other.value_)) {
|
||||
other.value_ = absl::monostate();
|
||||
}
|
||||
Json& operator=(Json&& other) noexcept {
|
||||
value_ = std::move(other.value_);
|
||||
other.value_ = absl::monostate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Returns the JSON type.
|
||||
Type type() const {
|
||||
struct ValueFunctor {
|
||||
Json::Type operator()(const absl::monostate&) { return Type::kNull; }
|
||||
Json::Type operator()(bool) { return Type::kBoolean; }
|
||||
Json::Type operator()(const NumberValue&) { return Type::kNumber; }
|
||||
Json::Type operator()(const std::string&) { return Type::kString; }
|
||||
Json::Type operator()(const Object&) { return Type::kObject; }
|
||||
Json::Type operator()(const Array&) { return Type::kArray; }
|
||||
};
|
||||
return absl::visit(ValueFunctor(), value_);
|
||||
}
|
||||
|
||||
// Payload accessor for kBoolean.
|
||||
// Must not be called for other types.
|
||||
bool boolean() const { return absl::get<bool>(value_); }
|
||||
|
||||
// Payload accessor for kNumber or kString.
|
||||
// Must not be called for other types.
|
||||
const std::string& string() const {
|
||||
const NumberValue* num = absl::get_if<NumberValue>(&value_);
|
||||
if (num != nullptr) return num->value;
|
||||
return absl::get<std::string>(value_);
|
||||
}
|
||||
|
||||
// Payload accessor for kObject.
|
||||
// Must not be called for other types.
|
||||
const Object& object() const { return absl::get<Object>(value_); }
|
||||
|
||||
// Payload accessor for kArray.
|
||||
// Must not be called for other types.
|
||||
const Array& array() const { return absl::get<Array>(value_); }
|
||||
|
||||
bool operator==(const Json& other) const { return value_ == other.value_; }
|
||||
bool operator!=(const Json& other) const { return !(*this == other); }
|
||||
|
||||
private:
|
||||
struct NumberValue {
|
||||
std::string value;
|
||||
|
||||
bool operator==(const NumberValue& other) const {
|
||||
return value == other.value;
|
||||
}
|
||||
};
|
||||
using Value = absl::variant<absl::monostate, // kNull
|
||||
bool, // kBoolean
|
||||
NumberValue, // kNumber
|
||||
std::string, // kString
|
||||
Object, // kObject
|
||||
Array>; // kArray
|
||||
|
||||
explicit Json(Value value) : value_(std::move(value)) {}
|
||||
|
||||
Value value_;
|
||||
};
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace grpc_core
|
||||
|
||||
#endif // GRPC_SUPPORT_JSON_H
|
||||
112
Pods/gRPC-Core/include/grpc/support/log.h
generated
Normal file
112
Pods/gRPC-Core/include/grpc/support/log.h
generated
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_LOG_H
|
||||
#define GRPC_SUPPORT_LOG_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h> /* for abort() */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** GPR log API.
|
||||
|
||||
Usage (within grpc):
|
||||
|
||||
int argument1 = 3;
|
||||
char* argument2 = "hello";
|
||||
gpr_log(GPR_DEBUG, "format string %d", argument1);
|
||||
gpr_log(GPR_INFO, "hello world");
|
||||
gpr_log(GPR_ERROR, "%d %s!!", argument1, argument2); */
|
||||
|
||||
/** The severity of a log message - use the #defines below when calling into
|
||||
gpr_log to additionally supply file and line data */
|
||||
typedef enum gpr_log_severity {
|
||||
GPR_LOG_SEVERITY_DEBUG,
|
||||
GPR_LOG_SEVERITY_INFO,
|
||||
GPR_LOG_SEVERITY_ERROR
|
||||
} gpr_log_severity;
|
||||
|
||||
/** Returns a string representation of the log severity */
|
||||
GPRAPI const char* gpr_log_severity_string(gpr_log_severity severity);
|
||||
|
||||
/** Macros to build log contexts at various severity levels */
|
||||
#define GPR_DEBUG __FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG
|
||||
#define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
|
||||
#define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
|
||||
|
||||
/** Log a message. It's advised to use GPR_xxx above to generate the context
|
||||
* for each message */
|
||||
GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity,
|
||||
const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
|
||||
|
||||
GPRAPI int gpr_should_log(gpr_log_severity severity);
|
||||
|
||||
GPRAPI void gpr_log_message(const char* file, int line,
|
||||
gpr_log_severity severity, const char* message);
|
||||
|
||||
/** Set global log verbosity */
|
||||
GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print);
|
||||
|
||||
GPRAPI void gpr_log_verbosity_init(void);
|
||||
|
||||
/** Log overrides: applications can use this API to intercept logging calls
|
||||
and use their own implementations */
|
||||
|
||||
struct gpr_log_func_args {
|
||||
const char* file;
|
||||
int line;
|
||||
gpr_log_severity severity;
|
||||
const char* message;
|
||||
};
|
||||
|
||||
typedef struct gpr_log_func_args gpr_log_func_args;
|
||||
|
||||
typedef void (*gpr_log_func)(gpr_log_func_args* args);
|
||||
GPRAPI void gpr_set_log_function(gpr_log_func func);
|
||||
|
||||
GPRAPI void gpr_assertion_failed(const char* filename, int line,
|
||||
const char* message) GPR_ATTRIBUTE_NORETURN;
|
||||
|
||||
/** abort() the process if x is zero, having written a line to the log.
|
||||
|
||||
Intended for internal invariants. If the error can be recovered from,
|
||||
without the possibility of corruption, or might best be reflected via
|
||||
an exception in a higher-level language, consider returning error code. */
|
||||
#define GPR_ASSERT(x) \
|
||||
do { \
|
||||
if (GPR_UNLIKELY(!(x))) { \
|
||||
gpr_assertion_failed(__FILE__, __LINE__, #x); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define GPR_DEBUG_ASSERT(x) GPR_ASSERT(x)
|
||||
#else
|
||||
#define GPR_DEBUG_ASSERT(x)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_LOG_H */
|
||||
38
Pods/gRPC-Core/include/grpc/support/log_windows.h
generated
Normal file
38
Pods/gRPC-Core/include/grpc/support/log_windows.h
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_LOG_WINDOWS_H
|
||||
#define GRPC_SUPPORT_LOG_WINDOWS_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Returns a string allocated with gpr_malloc that contains a UTF-8
|
||||
* formatted error message, corresponding to the error messageid.
|
||||
* Use in conjunction with GetLastError() et al.
|
||||
*/
|
||||
GPRAPI char* gpr_format_message(int messageid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_LOG_WINDOWS_H */
|
||||
861
Pods/gRPC-Core/include/grpc/support/port_platform.h
generated
Normal file
861
Pods/gRPC-Core/include/grpc/support/port_platform.h
generated
Normal file
@@ -0,0 +1,861 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_PORT_PLATFORM_H
|
||||
#define GRPC_SUPPORT_PORT_PLATFORM_H
|
||||
|
||||
// [[deprecated]] attribute is only available since C++14
|
||||
#if __cplusplus >= 201402L
|
||||
#define GRPC_DEPRECATED(reason) [[deprecated(reason)]]
|
||||
#else
|
||||
#define GRPC_DEPRECATED(reason)
|
||||
#endif // __cplusplus >= 201402L
|
||||
|
||||
/*
|
||||
* Defines GPR_ABSEIL_SYNC to use synchronization features from Abseil
|
||||
*/
|
||||
#ifndef GPR_ABSEIL_SYNC
|
||||
#if defined(__APPLE__)
|
||||
// This is disabled on Apple platforms because macos/grpc_basictests_c_cpp
|
||||
// fails with this. https://github.com/grpc/grpc/issues/23661
|
||||
#else
|
||||
#define GPR_ABSEIL_SYNC 1
|
||||
#endif
|
||||
#endif // GPR_ABSEIL_SYNC
|
||||
|
||||
/* Get windows.h included everywhere (we need it) */
|
||||
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif /* WIN32_LEAN_AND_MEAN */
|
||||
|
||||
// GPRC_DLL
|
||||
// inspired by
|
||||
// https://github.com/abseil/abseil-cpp/blob/20220623.1/absl/base/config.h#L730-L747
|
||||
//
|
||||
// When building gRPC as a DLL, this macro expands to `__declspec(dllexport)`
|
||||
// so we can annotate symbols appropriately as being exported. When used in
|
||||
// headers consuming a DLL, this macro expands to `__declspec(dllimport)` so
|
||||
// that consumers know the symbol is defined inside the DLL. In all other cases,
|
||||
// the macro expands to nothing.
|
||||
//
|
||||
// Warning: shared library support for Windows (i.e. producing DLL plus import
|
||||
// library instead of a static library) is experimental. Some symbols that can
|
||||
// be linked using the static library may not be available when using the
|
||||
// dynamically linked library.
|
||||
//
|
||||
// Note: GRPC_DLL_EXPORTS is set in CMakeLists.txt when building shared
|
||||
// grpc{,_unsecure}
|
||||
// GRPC_DLL_IMPORTS is set by us as part of the interface for consumers of
|
||||
// the DLL
|
||||
#if !defined(GRPC_DLL)
|
||||
#if defined(GRPC_DLL_EXPORTS)
|
||||
#define GRPC_DLL __declspec(dllexport)
|
||||
#elif defined(GRPC_DLL_IMPORTS)
|
||||
#define GRPC_DLL __declspec(dllimport)
|
||||
#else
|
||||
#define GRPC_DLL
|
||||
#endif // defined(GRPC_DLL_EXPORTS)
|
||||
#endif
|
||||
|
||||
// same for gRPC++
|
||||
#if !defined(GRPCXX_DLL)
|
||||
#if defined(GRPCXX_DLL_EXPORTS)
|
||||
#define GRPCXX_DLL __declspec(dllexport)
|
||||
#elif defined(GRPCXX_DLL_IMPORTS)
|
||||
#define GRPCXX_DLL __declspec(dllimport)
|
||||
#else
|
||||
#define GRPCXX_DLL
|
||||
#endif // defined(GRPCXX_DLL_EXPORTS)
|
||||
#endif
|
||||
|
||||
// same for GPR
|
||||
#if !defined(GPR_DLL)
|
||||
#if defined(GPR_DLL_EXPORTS)
|
||||
#define GPR_DLL __declspec(dllexport)
|
||||
#elif defined(GPR_DLL_IMPORTS)
|
||||
#define GPR_DLL __declspec(dllimport)
|
||||
#else
|
||||
#define GPR_DLL
|
||||
#endif // defined(GPR_DLL_EXPORTS)
|
||||
#endif
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define GRPC_NOMINMX_WAS_NOT_DEFINED
|
||||
#define NOMINMAX
|
||||
#endif /* NOMINMAX */
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#error \
|
||||
"Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
|
||||
#else /* !defined(_WIN32_WINNT) */
|
||||
#if (_WIN32_WINNT < 0x0600)
|
||||
#error \
|
||||
"Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"
|
||||
#endif /* _WIN32_WINNT < 0x0600 */
|
||||
|
||||
#ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
|
||||
#undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
|
||||
|
||||
#ifdef GRPC_NOMINMAX_WAS_NOT_DEFINED
|
||||
#undef GRPC_NOMINMAX_WAS_NOT_DEFINED
|
||||
#undef NOMINMAX
|
||||
#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
|
||||
#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || \
|
||||
defined(WIN32) */
|
||||
#else
|
||||
#define GRPC_DLL
|
||||
#define GRPCXX_DLL
|
||||
#define GPR_DLL
|
||||
#endif /* defined(_WIN32_WINNT) */
|
||||
|
||||
/* Override this file with one for your platform if you need to redefine
|
||||
things. */
|
||||
|
||||
#if !defined(GPR_NO_AUTODETECT_PLATFORM)
|
||||
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
|
||||
#if defined(_WIN64) || defined(WIN64)
|
||||
#define GPR_ARCH_64 1
|
||||
#else
|
||||
#define GPR_ARCH_32 1
|
||||
#endif
|
||||
#define GPR_PLATFORM_STRING "windows"
|
||||
#define GPR_WINDOWS 1
|
||||
#define GPR_WINDOWS_SUBPROCESS 1
|
||||
#define GPR_WINDOWS_ENV
|
||||
#ifdef __MSYS__
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#define GPR_MSYS_TMPFILE
|
||||
#define GPR_POSIX_LOG
|
||||
#define GPR_POSIX_STRING
|
||||
#define GPR_POSIX_TIME
|
||||
#else
|
||||
#define GPR_GETPID_IN_PROCESS_H 1
|
||||
#define GPR_WINDOWS_TMPFILE
|
||||
#define GPR_WINDOWS_LOG
|
||||
#define GPR_WINDOWS_CRASH_HANDLER 1
|
||||
#define GPR_WINDOWS_STAT
|
||||
#define GPR_WINDOWS_STRING
|
||||
#define GPR_WINDOWS_TIME
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#else
|
||||
#define GPR_WINDOWS_ATOMIC 1
|
||||
#endif
|
||||
#elif defined(ANDROID) || defined(__ANDROID__)
|
||||
#define GPR_PLATFORM_STRING "android"
|
||||
#define GPR_ANDROID 1
|
||||
#ifndef __ANDROID_API__
|
||||
#error "__ANDROID_API__ must be defined for Android builds."
|
||||
#endif
|
||||
#if __ANDROID_API__ < 21
|
||||
#error "Requires Android API v21 and above"
|
||||
#endif
|
||||
#define GPR_SUPPORT_BINDER_TRANSPORT 1
|
||||
// TODO(apolcyn): re-evaluate support for c-ares
|
||||
// on android after upgrading our c-ares dependency.
|
||||
// See https://github.com/grpc/grpc/issues/18038.
|
||||
#define GRPC_ARES 0
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_SYNC 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_ANDROID_LOG 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
||||
#elif defined(__linux__)
|
||||
#define GPR_PLATFORM_STRING "linux"
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#ifndef _DEFAULT_SOURCE
|
||||
#define _DEFAULT_SOURCE
|
||||
#endif
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <features.h>
|
||||
#define GPR_CPU_LINUX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_LINUX 1
|
||||
#define GPR_LINUX_LOG
|
||||
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
||||
#define GPR_LINUX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#ifdef __GLIBC__
|
||||
#define GPR_POSIX_CRASH_HANDLER 1
|
||||
#ifdef __GLIBC_PREREQ
|
||||
#if __GLIBC_PREREQ(2, 12)
|
||||
#define GPR_LINUX_PTHREAD_NAME 1
|
||||
#endif
|
||||
#else
|
||||
// musl libc & others
|
||||
#define GPR_LINUX_PTHREAD_NAME 1
|
||||
#endif
|
||||
#include <linux/version.h>
|
||||
#else /* musl libc */
|
||||
#define GPR_MUSL_LIBC_COMPAT 1
|
||||
#endif
|
||||
#elif defined(__ASYLO__)
|
||||
#define GPR_ARCH_64 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_PLATFORM_STRING "asylo"
|
||||
#define GPR_GCC_SYNC 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_ASYLO 1
|
||||
#define GRPC_POSIX_SOCKET 1
|
||||
#define GRPC_POSIX_SOCKETADDR
|
||||
#define GRPC_POSIX_SOCKETUTILS 1
|
||||
#define GRPC_TIMER_USE_GENERIC 1
|
||||
#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
|
||||
#define GRPC_POSIX_WAKEUP_FD 1
|
||||
#define GRPC_HAVE_MSG_NOSIGNAL 1
|
||||
#define GRPC_HAVE_UNIX_SOCKET 1
|
||||
#define GRPC_ARES 0
|
||||
#define GPR_NO_AUTODETECT_PLATFORM 1
|
||||
#elif defined(__APPLE__)
|
||||
#include <Availability.h>
|
||||
#include <TargetConditionals.h>
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#if TARGET_OS_IPHONE
|
||||
#define GPR_PLATFORM_STRING "ios"
|
||||
#define GPR_CPU_IPHONE 1
|
||||
#define GRPC_CFSTREAM 1
|
||||
/* the c-ares resolver isn't safe to enable on iOS */
|
||||
#define GRPC_ARES 0
|
||||
#else /* TARGET_OS_IPHONE */
|
||||
#define GPR_PLATFORM_STRING "osx"
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_POSIX_CRASH_HANDLER 1
|
||||
#endif
|
||||
#define GPR_APPLE 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#ifndef GRPC_CFSTREAM
|
||||
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
||||
#endif
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__FreeBSD__)
|
||||
#define GPR_PLATFORM_STRING "freebsd"
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#define GPR_FREEBSD 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__OpenBSD__)
|
||||
#define GPR_PLATFORM_STRING "openbsd"
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#define GPR_OPENBSD 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__sun) && defined(__SVR4)
|
||||
#define GPR_PLATFORM_STRING "solaris"
|
||||
#define GPR_SOLARIS 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(_AIX)
|
||||
#define GPR_PLATFORM_STRING "aix"
|
||||
#ifndef _ALL_SOURCE
|
||||
#define _ALL_SOURCE
|
||||
#endif
|
||||
#define GPR_AIX 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__NetBSD__)
|
||||
// NetBSD is a community-supported platform.
|
||||
// Please contact Thomas Klausner <wiz@NetBSD.org> for support.
|
||||
#define GPR_PLATFORM_STRING "netbsd"
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#define GPR_NETBSD 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_GCC_TLS 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__native_client__)
|
||||
#define GPR_PLATFORM_STRING "nacl"
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#ifndef _DEFAULT_SOURCE
|
||||
#define _DEFAULT_SOURCE
|
||||
#endif
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#define GPR_NACL 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__Fuchsia__)
|
||||
#define GRPC_ARES 0
|
||||
#define GPR_FUCHSIA 1
|
||||
#define GPR_ARCH_64 1
|
||||
#define GPR_PLATFORM_STRING "fuchsia"
|
||||
#include <features.h>
|
||||
// Specifying musl libc affects wrap_memcpy.c. It causes memmove() to be
|
||||
// invoked.
|
||||
#define GPR_MUSL_LIBC_COMPAT 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#define GRPC_ROOT_PEM_PATH "/config/ssl/cert.pem"
|
||||
#elif defined(__HAIKU__)
|
||||
#define GPR_PLATFORM_STRING "haiku"
|
||||
// Haiku is a community-supported platform.
|
||||
// Please contact Jerome Duval <jerome.duval@gmail.com> for support.
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#define GPR_HAIKU 1
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SUBPROCESS 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
#define GPR_PLATFORM_STRING "qnx"
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_ATOMIC 1
|
||||
#define GPR_POSIX_LOG 1
|
||||
#define GPR_POSIX_ENV 1
|
||||
#define GPR_POSIX_TMPFILE 1
|
||||
#define GPR_POSIX_STAT 1
|
||||
#define GPR_POSIX_STRING 1
|
||||
#define GPR_POSIX_SYNC 1
|
||||
#define GPR_POSIX_TIME 1
|
||||
#define GPR_HAS_PTHREAD_H 1
|
||||
#define GPR_GETPID_IN_UNISTD_H 1
|
||||
#ifdef _LP64
|
||||
#define GPR_ARCH_64 1
|
||||
#else /* _LP64 */
|
||||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#else
|
||||
#error "Could not auto-detect platform"
|
||||
#endif
|
||||
#endif /* GPR_NO_AUTODETECT_PLATFORM */
|
||||
|
||||
#if defined(__has_include)
|
||||
#if __has_include(<atomic>)
|
||||
#define GRPC_HAS_CXX11_ATOMIC
|
||||
#endif /* __has_include(<atomic>) */
|
||||
#endif /* defined(__has_include) */
|
||||
|
||||
#ifndef GPR_PLATFORM_STRING
|
||||
#warning "GPR_PLATFORM_STRING not auto-detected"
|
||||
#define GPR_PLATFORM_STRING "unknown"
|
||||
#endif
|
||||
|
||||
#ifdef GPR_GCOV
|
||||
#undef GPR_FORBID_UNREACHABLE_CODE
|
||||
#define GPR_FORBID_UNREACHABLE_CODE 1
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER < 1700
|
||||
typedef __int8 int8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif /* _MSC_VER < 1700 */
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Type of cycle clock implementation */
|
||||
#ifdef GPR_LINUX
|
||||
/* Disable cycle clock by default.
|
||||
TODO(soheil): enable when we support fallback for unstable cycle clocks.
|
||||
#if defined(__i386__)
|
||||
#define GPR_CYCLE_COUNTER_RDTSC_32 1
|
||||
#elif defined(__x86_64__) || defined(__amd64__)
|
||||
#define GPR_CYCLE_COUNTER_RDTSC_64 1
|
||||
#else
|
||||
#define GPR_CYCLE_COUNTER_FALLBACK 1
|
||||
#endif
|
||||
*/
|
||||
#define GPR_CYCLE_COUNTER_FALLBACK 1
|
||||
#else
|
||||
#define GPR_CYCLE_COUNTER_FALLBACK 1
|
||||
#endif /* GPR_LINUX */
|
||||
|
||||
/* Cache line alignment */
|
||||
#ifndef GPR_CACHELINE_SIZE_LOG
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#define GPR_CACHELINE_SIZE_LOG 6
|
||||
#endif
|
||||
#ifndef GPR_CACHELINE_SIZE_LOG
|
||||
/* A reasonable default guess. Note that overestimates tend to waste more
|
||||
space, while underestimates tend to waste more time. */
|
||||
#define GPR_CACHELINE_SIZE_LOG 6
|
||||
#endif /* GPR_CACHELINE_SIZE_LOG */
|
||||
#endif /* GPR_CACHELINE_SIZE_LOG */
|
||||
|
||||
#define GPR_CACHELINE_SIZE (1 << GPR_CACHELINE_SIZE_LOG)
|
||||
|
||||
/* scrub GCC_ATOMIC if it's not available on this compiler */
|
||||
#if defined(GPR_GCC_ATOMIC) && !defined(__ATOMIC_RELAXED)
|
||||
#undef GPR_GCC_ATOMIC
|
||||
#define GPR_GCC_SYNC 1
|
||||
#endif
|
||||
|
||||
/* Validate platform combinations */
|
||||
#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \
|
||||
defined(GPR_WINDOWS_ATOMIC) != \
|
||||
1
|
||||
#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WINDOWS_ATOMIC
|
||||
#endif
|
||||
|
||||
#if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1
|
||||
#error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64
|
||||
#endif
|
||||
|
||||
#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WINDOWS) + \
|
||||
defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
|
||||
1
|
||||
#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WINDOWS, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
|
||||
#endif
|
||||
|
||||
/* maximum alignment needed for any type on this platform, rounded up to a
|
||||
power of two */
|
||||
#define GPR_MAX_ALIGNMENT 16
|
||||
|
||||
#ifndef GRPC_ARES
|
||||
#define GRPC_ARES 1
|
||||
#endif
|
||||
|
||||
#ifndef GRPC_IF_NAMETOINDEX
|
||||
#define GRPC_IF_NAMETOINDEX 1
|
||||
#endif
|
||||
|
||||
#ifndef GRPC_UNUSED
|
||||
#if defined(__GNUC__) && !defined(__MINGW32__)
|
||||
#define GRPC_UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define GRPC_UNUSED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GPR_PRINT_FORMAT_CHECK
|
||||
#ifdef __GNUC__
|
||||
#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) \
|
||||
__attribute__((format(printf, FORMAT_STR, ARGS)))
|
||||
#else
|
||||
#define GPR_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
|
||||
#endif
|
||||
#endif /* GPR_PRINT_FORMAT_CHECK */
|
||||
|
||||
#ifndef GPR_HAS_CPP_ATTRIBUTE
|
||||
#ifdef __has_cpp_attribute
|
||||
#define GPR_HAS_CPP_ATTRIBUTE(a) __has_cpp_attribute(a)
|
||||
#else
|
||||
#define GPR_HAS_CPP_ATTRIBUTE(a) 0
|
||||
#endif
|
||||
#endif /* GPR_HAS_CPP_ATTRIBUTE */
|
||||
|
||||
#if defined(__GNUC__) && !defined(__MINGW32__)
|
||||
#define GPR_ALIGN_STRUCT(n) __attribute__((aligned(n)))
|
||||
#else
|
||||
#define GPR_ALIGN_STRUCT(n)
|
||||
#endif
|
||||
|
||||
#ifndef GRPC_MUST_USE_RESULT
|
||||
#if GPR_HAS_CPP_ATTRIBUTE(nodiscard)
|
||||
#define GRPC_MUST_USE_RESULT [[nodiscard]]
|
||||
#elif defined(__GNUC__) && !defined(__MINGW32__)
|
||||
#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
#define GRPC_MUST_USE_RESULT
|
||||
#endif
|
||||
#ifdef USE_STRICT_WARNING
|
||||
/* When building with USE_STRICT_WARNING (which -Werror), types with this
|
||||
attribute will be treated as annotated with warn_unused_result, enforcing
|
||||
returned values of this type should be used.
|
||||
This is added in grpc::Status in mind to address the issue where it always
|
||||
has this annotation internally but OSS doesn't, sometimes causing internal
|
||||
build failure. To prevent this, this is added while not introducing
|
||||
a breaking change to existing user code which may not use returned values
|
||||
of grpc::Status. */
|
||||
#define GRPC_MUST_USE_RESULT_WHEN_USE_STRICT_WARNING GRPC_MUST_USE_RESULT
|
||||
#else
|
||||
#define GRPC_MUST_USE_RESULT_WHEN_USE_STRICT_WARNING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GRPC_REINITIALIZES
|
||||
#if defined(__clang__)
|
||||
#if GPR_HAS_CPP_ATTRIBUTE(clang::reinitializes)
|
||||
#define GRPC_REINITIALIZES [[clang::reinitializes]]
|
||||
#else
|
||||
#define GRPC_REINITIALIZES
|
||||
#endif
|
||||
#else
|
||||
#define GRPC_REINITIALIZES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GPR_HAS_ATTRIBUTE
|
||||
#ifdef __has_attribute
|
||||
#define GPR_HAS_ATTRIBUTE(a) __has_attribute(a)
|
||||
#else
|
||||
#define GPR_HAS_ATTRIBUTE(a) 0
|
||||
#endif
|
||||
#endif /* GPR_HAS_ATTRIBUTE */
|
||||
|
||||
#if GPR_HAS_ATTRIBUTE(noreturn)
|
||||
#define GPR_ATTRIBUTE_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define GPR_ATTRIBUTE_NORETURN
|
||||
#endif
|
||||
|
||||
#if defined(GPR_FORBID_UNREACHABLE_CODE) && GPR_FORBID_UNREACHABLE_CODE
|
||||
#define GPR_UNREACHABLE_CODE(STATEMENT)
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void gpr_unreachable_code(const char* reason, const char* file,
|
||||
int line) GPR_ATTRIBUTE_NORETURN;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define GPR_UNREACHABLE_CODE(STATEMENT) \
|
||||
do { \
|
||||
gpr_unreachable_code(#STATEMENT, __FILE__, __LINE__); \
|
||||
STATEMENT; \
|
||||
} while (0)
|
||||
#endif /* GPR_FORBID_UNREACHABLE_CODE */
|
||||
|
||||
#ifndef GPRAPI
|
||||
#define GPRAPI
|
||||
#endif
|
||||
|
||||
#ifndef GRPCAPI
|
||||
#define GRPCAPI GPRAPI
|
||||
#endif
|
||||
|
||||
#ifndef CENSUSAPI
|
||||
#define CENSUSAPI GRPCAPI
|
||||
#endif
|
||||
|
||||
#ifndef GPR_HAS_FEATURE
|
||||
#ifdef __has_feature
|
||||
#define GPR_HAS_FEATURE(a) __has_feature(a)
|
||||
#else
|
||||
#define GPR_HAS_FEATURE(a) 0
|
||||
#endif
|
||||
#endif /* GPR_HAS_FEATURE */
|
||||
|
||||
#ifndef GPR_ATTRIBUTE_NOINLINE
|
||||
#if GPR_HAS_ATTRIBUTE(noinline) || (defined(__GNUC__) && !defined(__clang__))
|
||||
#define GPR_ATTRIBUTE_NOINLINE __attribute__((noinline))
|
||||
#define GPR_HAS_ATTRIBUTE_NOINLINE 1
|
||||
#else
|
||||
#define GPR_ATTRIBUTE_NOINLINE
|
||||
#endif
|
||||
#endif /* GPR_ATTRIBUTE_NOINLINE */
|
||||
|
||||
#ifndef GPR_NO_UNIQUE_ADDRESS
|
||||
#if GPR_HAS_CPP_ATTRIBUTE(no_unique_address)
|
||||
#define GPR_NO_UNIQUE_ADDRESS [[no_unique_address]]
|
||||
#else
|
||||
#define GPR_NO_UNIQUE_ADDRESS
|
||||
#endif
|
||||
#endif /* GPR_NO_UNIQUE_ADDRESS */
|
||||
|
||||
#ifndef GRPC_DEPRECATED
|
||||
#if GPR_HAS_CPP_ATTRIBUTE(deprecated)
|
||||
#define GRPC_DEPRECATED(reason) [[deprecated(reason)]]
|
||||
#else
|
||||
#define GRPC_DEPRECATED(reason)
|
||||
#endif
|
||||
#endif /* GRPC_DEPRECATED */
|
||||
|
||||
#ifndef GPR_ATTRIBUTE_WEAK
|
||||
/* Attribute weak is broken on LLVM/windows:
|
||||
* https://bugs.llvm.org/show_bug.cgi?id=37598 */
|
||||
#if (GPR_HAS_ATTRIBUTE(weak) || (defined(__GNUC__) && !defined(__clang__))) && \
|
||||
!(defined(__llvm__) && defined(_WIN32))
|
||||
#define GPR_ATTRIBUTE_WEAK __attribute__((weak))
|
||||
#define GPR_HAS_ATTRIBUTE_WEAK 1
|
||||
#else
|
||||
#define GPR_ATTRIBUTE_WEAK
|
||||
#endif
|
||||
#endif /* GPR_ATTRIBUTE_WEAK */
|
||||
|
||||
#ifndef GPR_ATTRIBUTE_NO_TSAN /* (1) */
|
||||
#if GPR_HAS_FEATURE(thread_sanitizer)
|
||||
#define GPR_ATTRIBUTE_NO_TSAN __attribute__((no_sanitize("thread")))
|
||||
#endif /* GPR_HAS_FEATURE */
|
||||
#ifndef GPR_ATTRIBUTE_NO_TSAN /* (2) */
|
||||
#define GPR_ATTRIBUTE_NO_TSAN
|
||||
#endif /* GPR_ATTRIBUTE_NO_TSAN (2) */
|
||||
#endif /* GPR_ATTRIBUTE_NO_TSAN (1) */
|
||||
|
||||
/* GRPC_TSAN_ENABLED will be defined, when compiled with thread sanitizer. */
|
||||
#ifndef GRPC_TSAN_SUPPRESSED
|
||||
#if defined(__SANITIZE_THREAD__)
|
||||
#define GRPC_TSAN_ENABLED
|
||||
#elif GPR_HAS_FEATURE(thread_sanitizer)
|
||||
#define GRPC_TSAN_ENABLED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* GRPC_ASAN_ENABLED will be defined, when compiled with address sanitizer. */
|
||||
#ifndef GRPC_ASAN_SUPPRESSED
|
||||
#if defined(__SANITIZE_ADDRESS__)
|
||||
#define GRPC_ASAN_ENABLED
|
||||
#elif GPR_HAS_FEATURE(address_sanitizer)
|
||||
#define GRPC_ASAN_ENABLED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* GRPC_ALLOW_EXCEPTIONS should be 0 or 1 if exceptions are allowed or not */
|
||||
#ifndef GRPC_ALLOW_EXCEPTIONS
|
||||
#ifdef GPR_WINDOWS
|
||||
#if defined(_MSC_VER) && defined(_CPPUNWIND)
|
||||
#define GRPC_ALLOW_EXCEPTIONS 1
|
||||
#elif defined(__EXCEPTIONS)
|
||||
#define GRPC_ALLOW_EXCEPTIONS 1
|
||||
#else
|
||||
#define GRPC_ALLOW_EXCEPTIONS 0
|
||||
#endif
|
||||
#else /* GPR_WINDOWS */
|
||||
#ifdef __EXCEPTIONS
|
||||
#define GRPC_ALLOW_EXCEPTIONS 1
|
||||
#else /* __EXCEPTIONS */
|
||||
#define GRPC_ALLOW_EXCEPTIONS 0
|
||||
#endif /* __EXCEPTIONS */
|
||||
#endif /* __GPR_WINDOWS */
|
||||
#endif /* GRPC_ALLOW_EXCEPTIONS */
|
||||
|
||||
/* Use GPR_LIKELY only in cases where you are sure that a certain outcome is the
|
||||
* most likely. Ideally, also collect performance numbers to justify the claim.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define GPR_LIKELY(x) __builtin_expect((x), 1)
|
||||
#define GPR_UNLIKELY(x) __builtin_expect((x), 0)
|
||||
#else /* __GNUC__ */
|
||||
#define GPR_LIKELY(x) (x)
|
||||
#define GPR_UNLIKELY(x) (x)
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
||||
/* MSVC doesn't do the empty base class optimization in debug builds by default,
|
||||
* and because of ABI likely won't.
|
||||
* This enables it for specific types, use as:
|
||||
* class GPR_MSVC_EMPTY_BASE_CLASS_WORKAROUND Foo : public A, public B, public C
|
||||
* {}; */
|
||||
#ifndef GPR_MSVC_EMPTY_BASE_CLASS_WORKAROUND
|
||||
#ifdef GPR_WINDOWS
|
||||
#define GPR_MSVC_EMPTY_BASE_CLASS_WORKAROUND __declspec(empty_bases)
|
||||
#else
|
||||
#define GPR_MSVC_EMPTY_BASE_CLASS_WORKAROUND
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define GRPC_CALLBACK_API_NONEXPERIMENTAL
|
||||
|
||||
/* clang 12 and lower with msan miscompiles destruction of [[no_unique_address]]
|
||||
* members of zero size - for a repro see:
|
||||
* test/core/compiler_bugs/miscompile_with_no_unique_address_test.cc
|
||||
*/
|
||||
#ifdef __clang__
|
||||
#if __clang__ && __clang_major__ <= 12 && __has_feature(memory_sanitizer)
|
||||
#undef GPR_NO_UNIQUE_ADDRESS
|
||||
#define GPR_NO_UNIQUE_ADDRESS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */
|
||||
51
Pods/gRPC-Core/include/grpc/support/string_util.h
generated
Normal file
51
Pods/gRPC-Core/include/grpc/support/string_util.h
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_STRING_UTIL_H
|
||||
#define GRPC_SUPPORT_STRING_UTIL_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <grpc/support/time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** String utility functions */
|
||||
|
||||
/** Returns a copy of src that can be passed to gpr_free().
|
||||
If allocation fails or if src is NULL, returns NULL. */
|
||||
GPRAPI char* gpr_strdup(const char* src);
|
||||
|
||||
/** printf to a newly-allocated string. The set of supported formats may vary
|
||||
between platforms.
|
||||
|
||||
On success, returns the number of bytes printed (excluding the final '\0'),
|
||||
and *strp points to a string which must later be destroyed with gpr_free().
|
||||
|
||||
On error, returns -1 and sets *strp to NULL. If the format string is bad,
|
||||
the result is undefined. */
|
||||
GPRAPI int gpr_asprintf(char** strp, const char* format, ...)
|
||||
GPR_PRINT_FORMAT_CHECK(2, 3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_STRING_UTIL_H */
|
||||
315
Pods/gRPC-Core/include/grpc/support/sync.h
generated
Normal file
315
Pods/gRPC-Core/include/grpc/support/sync.h
generated
Normal file
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_SYNC_H
|
||||
#define GRPC_SUPPORT_SYNC_H
|
||||
|
||||
/* Platform-specific type declarations of gpr_mu and gpr_cv. */
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <grpc/support/time.h> /* for gpr_timespec */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Synchronization primitives for GPR.
|
||||
|
||||
The type gpr_mu provides a non-reentrant mutex (lock).
|
||||
|
||||
The type gpr_cv provides a condition variable.
|
||||
|
||||
The type gpr_once provides for one-time initialization.
|
||||
|
||||
The type gpr_event provides one-time-setting, reading, and
|
||||
waiting of a void*, with memory barriers.
|
||||
|
||||
The type gpr_refcount provides an object reference counter,
|
||||
with memory barriers suitable to control
|
||||
object lifetimes.
|
||||
|
||||
The type gpr_stats_counter provides an atomic statistics counter. It
|
||||
provides no memory barriers.
|
||||
*/
|
||||
|
||||
#include <grpc/support/sync_generic.h> // IWYU pragma: export
|
||||
|
||||
#if defined(GPR_CUSTOM_SYNC)
|
||||
#include <grpc/support/sync_custom.h> // IWYU pragma: export
|
||||
#elif defined(GPR_ABSEIL_SYNC)
|
||||
#include <grpc/support/sync_abseil.h> // IWYU pragma: export
|
||||
#elif defined(GPR_POSIX_SYNC)
|
||||
#include <grpc/support/sync_posix.h> // IWYU pragma: export
|
||||
#elif defined(GPR_WINDOWS)
|
||||
#include <grpc/support/sync_windows.h> // IWYU pragma: export
|
||||
#else
|
||||
#error Unable to determine platform for sync
|
||||
#endif
|
||||
|
||||
/** --- Mutex interface ---
|
||||
|
||||
At most one thread may hold an exclusive lock on a mutex at any given time.
|
||||
Actions taken by a thread that holds a mutex exclusively happen after
|
||||
actions taken by all previous holders of the mutex. Variables of type
|
||||
gpr_mu are uninitialized when first declared. */
|
||||
|
||||
/** Initialize *mu. Requires: *mu uninitialized. */
|
||||
GPRAPI void gpr_mu_init(gpr_mu* mu);
|
||||
|
||||
/** Cause *mu no longer to be initialized, freeing any memory in use. Requires:
|
||||
*mu initialized; no other concurrent operation on *mu. */
|
||||
GPRAPI void gpr_mu_destroy(gpr_mu* mu);
|
||||
|
||||
/** Wait until no thread has a lock on *mu, cause the calling thread to own an
|
||||
exclusive lock on *mu, then return. May block indefinitely or crash if the
|
||||
calling thread has a lock on *mu. Requires: *mu initialized. */
|
||||
GPRAPI void gpr_mu_lock(gpr_mu* mu);
|
||||
|
||||
/** Release an exclusive lock on *mu held by the calling thread. Requires: *mu
|
||||
initialized; the calling thread holds an exclusive lock on *mu. */
|
||||
GPRAPI void gpr_mu_unlock(gpr_mu* mu);
|
||||
|
||||
/** Without blocking, attempt to acquire an exclusive lock on *mu for the
|
||||
calling thread, then return non-zero iff success. Fail, if any thread holds
|
||||
the lock; succeeds with high probability if no thread holds the lock.
|
||||
Requires: *mu initialized. */
|
||||
GPRAPI int gpr_mu_trylock(gpr_mu* mu);
|
||||
|
||||
/** --- Condition variable interface ---
|
||||
|
||||
A while-loop should be used with gpr_cv_wait() when waiting for conditions
|
||||
to become true. See the example below. Variables of type gpr_cv are
|
||||
uninitialized when first declared. */
|
||||
|
||||
/** Initialize *cv. Requires: *cv uninitialized. */
|
||||
GPRAPI void gpr_cv_init(gpr_cv* cv);
|
||||
|
||||
/** Cause *cv no longer to be initialized, freeing any memory in use. Requires:
|
||||
*cv initialized; no other concurrent operation on *cv.*/
|
||||
GPRAPI void gpr_cv_destroy(gpr_cv* cv);
|
||||
|
||||
/** Atomically release *mu and wait on *cv. When the calling thread is woken
|
||||
from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu)
|
||||
and return whether the deadline was exceeded. Use
|
||||
abs_deadline==gpr_inf_future for no deadline. abs_deadline can be either
|
||||
an absolute deadline, or a GPR_TIMESPAN. May return even when not
|
||||
woken explicitly. Requires: *mu and *cv initialized; the calling thread
|
||||
holds an exclusive lock on *mu. */
|
||||
GPRAPI int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline);
|
||||
|
||||
/** If any threads are waiting on *cv, wake at least one.
|
||||
Clients may treat this as an optimization of gpr_cv_broadcast()
|
||||
for use in the case where waking more than one waiter is not useful.
|
||||
Requires: *cv initialized. */
|
||||
GPRAPI void gpr_cv_signal(gpr_cv* cv);
|
||||
|
||||
/** Wake all threads waiting on *cv. Requires: *cv initialized. */
|
||||
GPRAPI void gpr_cv_broadcast(gpr_cv* cv);
|
||||
|
||||
/** --- One-time initialization ---
|
||||
|
||||
gpr_once must be declared with static storage class, and initialized with
|
||||
GPR_ONCE_INIT. e.g.,
|
||||
static gpr_once once_var = GPR_ONCE_INIT; */
|
||||
|
||||
/** Ensure that (*init_function)() has been called exactly once (for the
|
||||
specified gpr_once instance) and then return.
|
||||
If multiple threads call gpr_once() on the same gpr_once instance, one of
|
||||
them will call (*init_function)(), and the others will block until that call
|
||||
finishes.*/
|
||||
GPRAPI void gpr_once_init(gpr_once* once, void (*init_function)(void));
|
||||
|
||||
/** --- One-time event notification ---
|
||||
|
||||
These operations act on a gpr_event, which should be initialized with
|
||||
gpr_ev_init(), or with GPR_EVENT_INIT if static, e.g.,
|
||||
static gpr_event event_var = GPR_EVENT_INIT;
|
||||
It requires no destruction. */
|
||||
|
||||
/** Initialize *ev. */
|
||||
GPRAPI void gpr_event_init(gpr_event* ev);
|
||||
|
||||
/** Set *ev so that gpr_event_get() and gpr_event_wait() will return value.
|
||||
Requires: *ev initialized; value != NULL; no prior or concurrent calls to
|
||||
gpr_event_set(ev, ...) since initialization. */
|
||||
GPRAPI void gpr_event_set(gpr_event* ev, void* value);
|
||||
|
||||
/** Return the value set by gpr_event_set(ev, ...), or NULL if no such call has
|
||||
completed. If the result is non-NULL, all operations that occurred prior to
|
||||
the gpr_event_set(ev, ...) set will be visible after this call returns.
|
||||
Requires: *ev initialized. This operation is faster than acquiring a mutex
|
||||
on most platforms. */
|
||||
GPRAPI void* gpr_event_get(gpr_event* ev);
|
||||
|
||||
/** Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is
|
||||
exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use
|
||||
abs_deadline==gpr_inf_future for no deadline. When the event has been
|
||||
signalled before the call, this operation is faster than acquiring a mutex
|
||||
on most platforms. */
|
||||
GPRAPI void* gpr_event_wait(gpr_event* ev, gpr_timespec abs_deadline);
|
||||
|
||||
/** --- Reference counting ---
|
||||
|
||||
These calls act on the type gpr_refcount. It requires no destruction. */
|
||||
|
||||
/** Initialize *r to value n. */
|
||||
GPRAPI void gpr_ref_init(gpr_refcount* r, int n);
|
||||
|
||||
/** Increment the reference count *r. Requires *r initialized. */
|
||||
GPRAPI void gpr_ref(gpr_refcount* r);
|
||||
|
||||
/** Increment the reference count *r. Requires *r initialized.
|
||||
Crashes if refcount is zero */
|
||||
GPRAPI void gpr_ref_non_zero(gpr_refcount* r);
|
||||
|
||||
/** Increment the reference count *r by n. Requires *r initialized, n > 0. */
|
||||
GPRAPI void gpr_refn(gpr_refcount* r, int n);
|
||||
|
||||
/** Decrement the reference count *r and return non-zero iff it has reached
|
||||
zero. . Requires *r initialized. */
|
||||
GPRAPI int gpr_unref(gpr_refcount* r);
|
||||
|
||||
/** Return non-zero iff the reference count of *r is one, and thus is owned
|
||||
by exactly one object. */
|
||||
GPRAPI int gpr_ref_is_unique(gpr_refcount* r);
|
||||
|
||||
/** --- Stats counters ---
|
||||
|
||||
These calls act on the integral type gpr_stats_counter. It requires no
|
||||
destruction. Static instances may be initialized with
|
||||
gpr_stats_counter c = GPR_STATS_INIT;
|
||||
Beware: These operations do not imply memory barriers. Do not use them to
|
||||
synchronize other events. */
|
||||
|
||||
/** Initialize *c to the value n. */
|
||||
GPRAPI void gpr_stats_init(gpr_stats_counter* c, intptr_t n);
|
||||
|
||||
/** *c += inc. Requires: *c initialized. */
|
||||
GPRAPI void gpr_stats_inc(gpr_stats_counter* c, intptr_t inc);
|
||||
|
||||
/** Return *c. Requires: *c initialized. */
|
||||
GPRAPI intptr_t gpr_stats_read(const gpr_stats_counter* c);
|
||||
|
||||
/** ==================Example use of interface===================
|
||||
A producer-consumer queue of up to N integers,
|
||||
illustrating the use of the calls in this interface. */
|
||||
#if 0
|
||||
|
||||
#define N 4
|
||||
|
||||
typedef struct queue {
|
||||
gpr_cv non_empty; /* Signalled when length becomes non-zero. */
|
||||
gpr_cv non_full; /* Signalled when length becomes non-N. */
|
||||
gpr_mu mu; /* Protects all fields below.
|
||||
(That is, except during initialization or
|
||||
destruction, the fields below should be accessed
|
||||
only by a thread that holds mu.) */
|
||||
int head; /* Index of head of queue 0..N-1. */
|
||||
int length; /* Number of valid elements in queue 0..N. */
|
||||
int elem[N]; /* elem[head .. head+length-1] are queue elements. */
|
||||
} queue;
|
||||
|
||||
/* Initialize *q. */
|
||||
void queue_init(queue *q) {
|
||||
gpr_mu_init(&q->mu);
|
||||
gpr_cv_init(&q->non_empty);
|
||||
gpr_cv_init(&q->non_full);
|
||||
q->head = 0;
|
||||
q->length = 0;
|
||||
}
|
||||
|
||||
/* Free storage associated with *q. */
|
||||
void queue_destroy(queue *q) {
|
||||
gpr_mu_destroy(&q->mu);
|
||||
gpr_cv_destroy(&q->non_empty);
|
||||
gpr_cv_destroy(&q->non_full);
|
||||
}
|
||||
|
||||
/* Wait until there is room in *q, then append x to *q. */
|
||||
void queue_append(queue *q, int x) {
|
||||
gpr_mu_lock(&q->mu);
|
||||
/* To wait for a predicate without a deadline, loop on the negation of the
|
||||
predicate, and use gpr_cv_wait(..., gpr_inf_future) inside the loop
|
||||
to release the lock, wait, and reacquire on each iteration. Code that
|
||||
makes the condition true should use gpr_cv_broadcast() on the
|
||||
corresponding condition variable. The predicate must be on state
|
||||
protected by the lock. */
|
||||
while (q->length == N) {
|
||||
gpr_cv_wait(&q->non_full, &q->mu, gpr_inf_future);
|
||||
}
|
||||
if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
|
||||
/* It's normal to use gpr_cv_broadcast() or gpr_signal() while
|
||||
holding the lock. */
|
||||
gpr_cv_broadcast(&q->non_empty);
|
||||
}
|
||||
q->elem[(q->head + q->length) % N] = x;
|
||||
q->length++;
|
||||
gpr_mu_unlock(&q->mu);
|
||||
}
|
||||
|
||||
/* If it can be done without blocking, append x to *q and return non-zero.
|
||||
Otherwise return 0. */
|
||||
int queue_try_append(queue *q, int x) {
|
||||
int result = 0;
|
||||
if (gpr_mu_trylock(&q->mu)) {
|
||||
if (q->length != N) {
|
||||
if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
|
||||
gpr_cv_broadcast(&q->non_empty);
|
||||
}
|
||||
q->elem[(q->head + q->length) % N] = x;
|
||||
q->length++;
|
||||
result = 1;
|
||||
}
|
||||
gpr_mu_unlock(&q->mu);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Wait until the *q is non-empty or deadline abs_deadline passes. If the
|
||||
queue is non-empty, remove its head entry, place it in *head, and return
|
||||
non-zero. Otherwise return 0. */
|
||||
int queue_remove(queue *q, int *head, gpr_timespec abs_deadline) {
|
||||
int result = 0;
|
||||
gpr_mu_lock(&q->mu);
|
||||
/* To wait for a predicate with a deadline, loop on the negation of the
|
||||
predicate or until gpr_cv_wait() returns true. Code that makes
|
||||
the condition true should use gpr_cv_broadcast() on the corresponding
|
||||
condition variable. The predicate must be on state protected by the
|
||||
lock. */
|
||||
while (q->length == 0 &&
|
||||
!gpr_cv_wait(&q->non_empty, &q->mu, abs_deadline)) {
|
||||
}
|
||||
if (q->length != 0) { /* Queue is non-empty. */
|
||||
result = 1;
|
||||
if (q->length == N) { /* Wake threads blocked in queue_append(). */
|
||||
gpr_cv_broadcast(&q->non_full);
|
||||
}
|
||||
*head = q->elem[q->head];
|
||||
q->head = (q->head + 1) % N;
|
||||
q->length--;
|
||||
} /* else deadline exceeded */
|
||||
gpr_mu_unlock(&q->mu);
|
||||
return result;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_SYNC_H */
|
||||
36
Pods/gRPC-Core/include/grpc/support/sync_abseil.h
generated
Normal file
36
Pods/gRPC-Core/include/grpc/support/sync_abseil.h
generated
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2020 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_SYNC_ABSEIL_H
|
||||
#define GRPC_SUPPORT_SYNC_ABSEIL_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <grpc/support/sync_generic.h>
|
||||
|
||||
#ifdef GPR_ABSEIL_SYNC
|
||||
|
||||
typedef intptr_t gpr_mu;
|
||||
typedef intptr_t gpr_cv;
|
||||
typedef int32_t gpr_once;
|
||||
|
||||
#define GPR_ONCE_INIT 0
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_SYNC_ABSEIL_H */
|
||||
38
Pods/gRPC-Core/include/grpc/support/sync_custom.h
generated
Normal file
38
Pods/gRPC-Core/include/grpc/support/sync_custom.h
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_SYNC_CUSTOM_H
|
||||
#define GRPC_SUPPORT_SYNC_CUSTOM_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <grpc/support/sync_generic.h>
|
||||
|
||||
/* Users defining GPR_CUSTOM_SYNC need to define the following macros. */
|
||||
|
||||
#ifdef GPR_CUSTOM_SYNC
|
||||
|
||||
typedef GPR_CUSTOM_MU_TYPE gpr_mu;
|
||||
typedef GPR_CUSTOM_CV_TYPE gpr_cv;
|
||||
typedef GPR_CUSTOM_ONCE_TYPE gpr_once;
|
||||
|
||||
#define GPR_ONCE_INIT GPR_CUSTOM_ONCE_INIT
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_SYNC_CUSTOM_H */
|
||||
49
Pods/gRPC-Core/include/grpc/support/sync_generic.h
generated
Normal file
49
Pods/gRPC-Core/include/grpc/support/sync_generic.h
generated
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_SYNC_GENERIC_H
|
||||
#define GRPC_SUPPORT_SYNC_GENERIC_H
|
||||
|
||||
/* Generic type definitions for gpr_sync. */
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <grpc/support/atm.h>
|
||||
|
||||
/* gpr_event */
|
||||
typedef struct {
|
||||
gpr_atm state;
|
||||
} gpr_event;
|
||||
|
||||
#define GPR_EVENT_INIT \
|
||||
{ 0 }
|
||||
|
||||
/* gpr_refcount */
|
||||
typedef struct {
|
||||
gpr_atm count;
|
||||
} gpr_refcount;
|
||||
|
||||
/* gpr_stats_counter */
|
||||
typedef struct {
|
||||
gpr_atm value;
|
||||
} gpr_stats_counter;
|
||||
|
||||
#define GPR_STATS_INIT \
|
||||
{ 0 }
|
||||
|
||||
#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */
|
||||
52
Pods/gRPC-Core/include/grpc/support/sync_posix.h
generated
Normal file
52
Pods/gRPC-Core/include/grpc/support/sync_posix.h
generated
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_SYNC_POSIX_H
|
||||
#define GRPC_SUPPORT_SYNC_POSIX_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <grpc/support/sync_generic.h>
|
||||
|
||||
#ifdef GRPC_ASAN_ENABLED
|
||||
/* The member |leak_checker| is used to check whether there is a memory leak
|
||||
* caused by upper layer logic that's missing the |gpr_xx_destroy| call
|
||||
* to the object before freeing it.
|
||||
* This issue was reported at https://github.com/grpc/grpc/issues/17563
|
||||
* and discussed at https://github.com/grpc/grpc/pull/17586
|
||||
*/
|
||||
typedef struct {
|
||||
pthread_mutex_t mutex;
|
||||
int* leak_checker;
|
||||
} gpr_mu;
|
||||
|
||||
typedef struct {
|
||||
pthread_cond_t cond_var;
|
||||
int* leak_checker;
|
||||
} gpr_cv;
|
||||
#else
|
||||
typedef pthread_mutex_t gpr_mu;
|
||||
typedef pthread_cond_t gpr_cv;
|
||||
#endif
|
||||
typedef pthread_once_t gpr_once;
|
||||
|
||||
#define GPR_ONCE_INIT PTHREAD_ONCE_INIT
|
||||
|
||||
#endif /* GRPC_SUPPORT_SYNC_POSIX_H */
|
||||
40
Pods/gRPC-Core/include/grpc/support/sync_windows.h
generated
Normal file
40
Pods/gRPC-Core/include/grpc/support/sync_windows.h
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_SYNC_WINDOWS_H
|
||||
#define GRPC_SUPPORT_SYNC_WINDOWS_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#ifdef GPR_WINDOWS
|
||||
|
||||
#include <grpc/support/sync_generic.h>
|
||||
|
||||
typedef struct {
|
||||
CRITICAL_SECTION cs; /* Not an SRWLock until Vista is unsupported */
|
||||
int locked;
|
||||
} gpr_mu;
|
||||
|
||||
typedef CONDITION_VARIABLE gpr_cv;
|
||||
|
||||
typedef INIT_ONCE gpr_once;
|
||||
#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
|
||||
|
||||
#endif /* GPR_WINDOWS */
|
||||
|
||||
#endif /* GRPC_SUPPORT_SYNC_WINDOWS_H */
|
||||
44
Pods/gRPC-Core/include/grpc/support/thd_id.h
generated
Normal file
44
Pods/gRPC-Core/include/grpc/support/thd_id.h
generated
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2018 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_THD_ID_H
|
||||
#define GRPC_SUPPORT_THD_ID_H
|
||||
/** Thread ID interface for GPR.
|
||||
|
||||
Used by some wrapped languages for logging purposes.
|
||||
|
||||
Types
|
||||
gpr_thd_id a unique opaque identifier for a thread.
|
||||
*/
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef uintptr_t gpr_thd_id;
|
||||
|
||||
/** Returns the identifier of the current thread. */
|
||||
GPRAPI gpr_thd_id gpr_thd_currentid(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_THD_ID_H */
|
||||
117
Pods/gRPC-Core/include/grpc/support/time.h
generated
Normal file
117
Pods/gRPC-Core/include/grpc/support/time.h
generated
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_TIME_H
|
||||
#define GRPC_SUPPORT_TIME_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** The clocks we support. */
|
||||
typedef enum {
|
||||
/** Monotonic clock. Epoch undefined. Always moves forwards. */
|
||||
GPR_CLOCK_MONOTONIC = 0,
|
||||
/** Realtime clock. May jump forwards or backwards. Settable by
|
||||
the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970. */
|
||||
GPR_CLOCK_REALTIME,
|
||||
/** CPU cycle time obtained by rdtsc instruction on x86 platforms. Epoch
|
||||
undefined. Degrades to GPR_CLOCK_REALTIME on other platforms. */
|
||||
GPR_CLOCK_PRECISE,
|
||||
/** Unmeasurable clock type: no base, created by taking the difference
|
||||
between two times */
|
||||
GPR_TIMESPAN
|
||||
} gpr_clock_type;
|
||||
|
||||
/** Analogous to struct timespec. On some machines, absolute times may be in
|
||||
* local time. */
|
||||
typedef struct gpr_timespec {
|
||||
int64_t tv_sec;
|
||||
int32_t tv_nsec;
|
||||
/** Against which clock was this time measured? (or GPR_TIMESPAN if
|
||||
this is a relative time measure) */
|
||||
gpr_clock_type clock_type;
|
||||
} gpr_timespec;
|
||||
|
||||
/** Time constants. */
|
||||
/** The zero time interval. */
|
||||
GPRAPI gpr_timespec gpr_time_0(gpr_clock_type type);
|
||||
/** The far future */
|
||||
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type);
|
||||
/** The far past. */
|
||||
GPRAPI gpr_timespec gpr_inf_past(gpr_clock_type type);
|
||||
|
||||
#define GPR_MS_PER_SEC 1000
|
||||
#define GPR_US_PER_SEC 1000000
|
||||
#define GPR_NS_PER_SEC 1000000000
|
||||
#define GPR_NS_PER_MS 1000000
|
||||
#define GPR_NS_PER_US 1000
|
||||
#define GPR_US_PER_MS 1000
|
||||
|
||||
/** initialize time subsystem */
|
||||
GPRAPI void gpr_time_init(void);
|
||||
|
||||
/** Return the current time measured from the given clocks epoch. */
|
||||
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock);
|
||||
|
||||
/** Convert a timespec from one clock to another */
|
||||
GPRAPI gpr_timespec gpr_convert_clock_type(gpr_timespec t,
|
||||
gpr_clock_type clock_type);
|
||||
|
||||
/** Return -ve, 0, or +ve according to whether a < b, a == b, or a > b
|
||||
respectively. */
|
||||
GPRAPI int gpr_time_cmp(gpr_timespec a, gpr_timespec b);
|
||||
|
||||
GPRAPI gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b);
|
||||
GPRAPI gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
|
||||
|
||||
/** Add and subtract times. Calculations saturate at infinities. */
|
||||
GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
|
||||
GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
|
||||
|
||||
/** Return a timespec representing a given number of time units. INT64_MIN is
|
||||
interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future. */
|
||||
GPRAPI gpr_timespec gpr_time_from_micros(int64_t us, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_seconds(int64_t s, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_minutes(int64_t m, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_hours(int64_t h, gpr_clock_type clock_type);
|
||||
|
||||
GPRAPI int32_t gpr_time_to_millis(gpr_timespec timespec);
|
||||
|
||||
/** Return 1 if two times are equal or within threshold of each other,
|
||||
0 otherwise */
|
||||
GPRAPI int gpr_time_similar(gpr_timespec a, gpr_timespec b,
|
||||
gpr_timespec threshold);
|
||||
|
||||
/** Sleep until at least 'until' - an absolute timeout */
|
||||
GPRAPI void gpr_sleep_until(gpr_timespec until);
|
||||
|
||||
GPRAPI double gpr_timespec_to_micros(gpr_timespec t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_TIME_H */
|
||||
31
Pods/gRPC-Core/include/grpc/support/workaround_list.h
generated
Normal file
31
Pods/gRPC-Core/include/grpc/support/workaround_list.h
generated
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPC_SUPPORT_WORKAROUND_LIST_H
|
||||
#define GRPC_SUPPORT_WORKAROUND_LIST_H
|
||||
|
||||
/* The list of IDs of server workarounds currently maintained by gRPC. For
|
||||
* explanation and detailed descriptions of workarounds, see
|
||||
* /doc/workarounds.md
|
||||
*/
|
||||
typedef enum {
|
||||
GRPC_WORKAROUND_ID_CRONET_COMPRESSION = 0,
|
||||
GRPC_MAX_WORKAROUND_ID
|
||||
} grpc_workaround_list;
|
||||
|
||||
#endif /* GRPC_SUPPORT_WORKAROUND_LIST_H */
|
||||
Reference in New Issue
Block a user