Merge pull request #21986 from veblush/absl-lock-pre

Added abseil-based sync
pull/21999/head
Esun Kim 5 years ago committed by GitHub
commit 9b5e418ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      BUILD
  2. 6
      BUILD.gn
  3. 18
      CMakeLists.txt
  4. 18
      Makefile
  5. 3
      build.yaml
  6. 1
      config.m4
  7. 1
      config.w32
  8. 3
      gRPC-Core.podspec
  9. 3
      grpc.gemspec
  10. 1
      grpc.gyp
  11. 7
      include/grpc/impl/codegen/port_platform.h
  12. 8
      include/grpc/impl/codegen/sync.h
  13. 36
      include/grpc/impl/codegen/sync_abseil.h
  14. 3
      include/grpc/module.modulemap
  15. 26
      include/grpc/support/sync_abseil.h
  16. 3
      package.xml
  17. 114
      src/core/lib/gpr/sync_abseil.cc
  18. 13
      src/core/lib/gpr/sync_posix.cc
  19. 6
      src/core/lib/gpr/sync_windows.cc
  20. 1
      src/python/grpcio/grpc_core_dependencies.py
  21. 2
      test/core/surface/public_headers_must_be_c89.c
  22. 2
      tools/doxygen/Doxyfile.c++
  23. 2
      tools/doxygen/Doxyfile.c++.internal
  24. 3
      tools/doxygen/Doxyfile.core
  25. 4
      tools/doxygen/Doxyfile.core.internal

@ -98,6 +98,7 @@ GPR_PUBLIC_HDRS = [
"include/grpc/support/port_platform.h",
"include/grpc/support/string_util.h",
"include/grpc/support/sync.h",
"include/grpc/support/sync_abseil.h",
"include/grpc/support/sync_custom.h",
"include/grpc/support/sync_generic.h",
"include/grpc/support/sync_posix.h",
@ -509,6 +510,7 @@ grpc_cc_library(
"src/core/lib/gpr/string_util_windows.cc",
"src/core/lib/gpr/string_windows.cc",
"src/core/lib/gpr/sync.cc",
"src/core/lib/gpr/sync_abseil.cc",
"src/core/lib/gpr/sync_posix.cc",
"src/core/lib/gpr/sync_windows.cc",
"src/core/lib/gpr/time.cc",
@ -587,6 +589,7 @@ grpc_cc_library(
"include/grpc/impl/codegen/log.h",
"include/grpc/impl/codegen/port_platform.h",
"include/grpc/impl/codegen/sync.h",
"include/grpc/impl/codegen/sync_abseil.h",
"include/grpc/impl/codegen/sync_custom.h",
"include/grpc/impl/codegen/sync_generic.h",
"include/grpc/impl/codegen/sync_posix.h",

@ -66,6 +66,7 @@ config("grpc_config") {
"include/grpc/impl/codegen/log.h",
"include/grpc/impl/codegen/port_platform.h",
"include/grpc/impl/codegen/sync.h",
"include/grpc/impl/codegen/sync_abseil.h",
"include/grpc/impl/codegen/sync_custom.h",
"include/grpc/impl/codegen/sync_generic.h",
"include/grpc/impl/codegen/sync_posix.h",
@ -81,6 +82,7 @@ config("grpc_config") {
"include/grpc/support/port_platform.h",
"include/grpc/support/string_util.h",
"include/grpc/support/sync.h",
"include/grpc/support/sync_abseil.h",
"include/grpc/support/sync_custom.h",
"include/grpc/support/sync_generic.h",
"include/grpc/support/sync_posix.h",
@ -114,6 +116,7 @@ config("grpc_config") {
"src/core/lib/gpr/string_windows.cc",
"src/core/lib/gpr/string_windows.h",
"src/core/lib/gpr/sync.cc",
"src/core/lib/gpr/sync_abseil.cc",
"src/core/lib/gpr/sync_posix.cc",
"src/core/lib/gpr/sync_windows.cc",
"src/core/lib/gpr/time.cc",
@ -199,6 +202,7 @@ config("grpc_config") {
"include/grpc/impl/codegen/slice.h",
"include/grpc/impl/codegen/status.h",
"include/grpc/impl/codegen/sync.h",
"include/grpc/impl/codegen/sync_abseil.h",
"include/grpc/impl/codegen/sync_custom.h",
"include/grpc/impl/codegen/sync_generic.h",
"include/grpc/impl/codegen/sync_posix.h",
@ -1051,6 +1055,7 @@ config("grpc_config") {
"include/grpc/impl/codegen/slice.h",
"include/grpc/impl/codegen/status.h",
"include/grpc/impl/codegen/sync.h",
"include/grpc/impl/codegen/sync_abseil.h",
"include/grpc/impl/codegen/sync_custom.h",
"include/grpc/impl/codegen/sync_generic.h",
"include/grpc/impl/codegen/sync_posix.h",
@ -1070,6 +1075,7 @@ config("grpc_config") {
"include/grpc/support/port_platform.h",
"include/grpc/support/string_util.h",
"include/grpc/support/sync.h",
"include/grpc/support/sync_abseil.h",
"include/grpc/support/sync_custom.h",
"include/grpc/support/sync_generic.h",
"include/grpc/support/sync_posix.h",

@ -1286,6 +1286,7 @@ foreach(_hdr
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_abseil.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
@ -1302,6 +1303,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -1384,6 +1386,7 @@ add_library(gpr
src/core/lib/gpr/string_util_windows.cc
src/core/lib/gpr/string_windows.cc
src/core/lib/gpr/sync.cc
src/core/lib/gpr/sync_abseil.cc
src/core/lib/gpr/sync_posix.cc
src/core/lib/gpr/sync_windows.cc
src/core/lib/gpr/time.cc
@ -1458,6 +1461,7 @@ foreach(_hdr
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_abseil.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
@ -1474,6 +1478,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -1942,6 +1947,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -2352,6 +2358,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -2686,6 +2693,7 @@ foreach(_hdr
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_abseil.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
@ -2702,6 +2710,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -3028,6 +3037,7 @@ foreach(_hdr
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_abseil.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
@ -3044,6 +3054,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -3436,6 +3447,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -3886,6 +3898,7 @@ foreach(_hdr
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_abseil.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
@ -3902,6 +3915,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -4585,6 +4599,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -4782,6 +4797,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h
@ -5018,6 +5034,7 @@ foreach(_hdr
include/grpc/support/port_platform.h
include/grpc/support/string_util.h
include/grpc/support/sync.h
include/grpc/support/sync_abseil.h
include/grpc/support/sync_custom.h
include/grpc/support/sync_generic.h
include/grpc/support/sync_posix.h
@ -5034,6 +5051,7 @@ foreach(_hdr
include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h
include/grpc/impl/codegen/sync.h
include/grpc/impl/codegen/sync_abseil.h
include/grpc/impl/codegen/sync_custom.h
include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h

@ -3759,6 +3759,7 @@ PUBLIC_HEADERS_C += \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
@ -3775,6 +3776,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -3882,6 +3884,7 @@ LIBGPR_SRC = \
src/core/lib/gpr/string_util_windows.cc \
src/core/lib/gpr/string_windows.cc \
src/core/lib/gpr/sync.cc \
src/core/lib/gpr/sync_abseil.cc \
src/core/lib/gpr/sync_posix.cc \
src/core/lib/gpr/sync_windows.cc \
src/core/lib/gpr/time.cc \
@ -3915,6 +3918,7 @@ PUBLIC_HEADERS_C += \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
@ -3931,6 +3935,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -4376,6 +4381,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -4778,6 +4784,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -5108,6 +5115,7 @@ PUBLIC_HEADERS_C += \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
@ -5124,6 +5132,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -5436,6 +5445,7 @@ PUBLIC_HEADERS_C += \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
@ -5452,6 +5462,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -5813,6 +5824,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -6230,6 +6242,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
@ -6246,6 +6259,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -6919,6 +6933,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -7099,6 +7114,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -7337,6 +7353,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
@ -7353,6 +7370,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \

@ -248,6 +248,7 @@ filegroups:
- src/core/lib/gpr/string_util_windows.cc
- src/core/lib/gpr/string_windows.cc
- src/core/lib/gpr/sync.cc
- src/core/lib/gpr/sync_abseil.cc
- src/core/lib/gpr/sync_posix.cc
- src/core/lib/gpr/sync_windows.cc
- src/core/lib/gpr/time.cc
@ -287,6 +288,7 @@ filegroups:
- include/grpc/support/port_platform.h
- include/grpc/support/string_util.h
- include/grpc/support/sync.h
- include/grpc/support/sync_abseil.h
- include/grpc/support/sync_custom.h
- include/grpc/support/sync_generic.h
- include/grpc/support/sync_posix.h
@ -337,6 +339,7 @@ filegroups:
- include/grpc/impl/codegen/log.h
- include/grpc/impl/codegen/port_platform.h
- include/grpc/impl/codegen/sync.h
- include/grpc/impl/codegen/sync_abseil.h
- include/grpc/impl/codegen/sync_custom.h
- include/grpc/impl/codegen/sync_generic.h
- include/grpc/impl/codegen/sync_posix.h

@ -230,6 +230,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gpr/string_util_windows.cc \
src/core/lib/gpr/string_windows.cc \
src/core/lib/gpr/sync.cc \
src/core/lib/gpr/sync_abseil.cc \
src/core/lib/gpr/sync_posix.cc \
src/core/lib/gpr/sync_windows.cc \
src/core/lib/gpr/time.cc \

@ -199,6 +199,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gpr\\string_util_windows.cc " +
"src\\core\\lib\\gpr\\string_windows.cc " +
"src\\core\\lib\\gpr\\sync.cc " +
"src\\core\\lib\\gpr\\sync_abseil.cc " +
"src\\core\\lib\\gpr\\sync_posix.cc " +
"src\\core\\lib\\gpr\\sync_windows.cc " +
"src\\core\\lib\\gpr\\time.cc " +

@ -139,6 +139,7 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/slice.h',
'include/grpc/impl/codegen/status.h',
'include/grpc/impl/codegen/sync.h',
'include/grpc/impl/codegen/sync_abseil.h',
'include/grpc/impl/codegen/sync_custom.h',
'include/grpc/impl/codegen/sync_generic.h',
'include/grpc/impl/codegen/sync_posix.h',
@ -158,6 +159,7 @@ Pod::Spec.new do |s|
'include/grpc/support/port_platform.h',
'include/grpc/support/string_util.h',
'include/grpc/support/sync.h',
'include/grpc/support/sync_abseil.h',
'include/grpc/support/sync_custom.h',
'include/grpc/support/sync_generic.h',
'include/grpc/support/sync_posix.h',
@ -531,6 +533,7 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/string_windows.cc',
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/sync.cc',
'src/core/lib/gpr/sync_abseil.cc',
'src/core/lib/gpr/sync_posix.cc',
'src/core/lib/gpr/sync_windows.cc',
'src/core/lib/gpr/time.cc',

@ -73,6 +73,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/slice.h )
s.files += %w( include/grpc/impl/codegen/status.h )
s.files += %w( include/grpc/impl/codegen/sync.h )
s.files += %w( include/grpc/impl/codegen/sync_abseil.h )
s.files += %w( include/grpc/impl/codegen/sync_custom.h )
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
@ -92,6 +93,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/port_platform.h )
s.files += %w( include/grpc/support/string_util.h )
s.files += %w( include/grpc/support/sync.h )
s.files += %w( include/grpc/support/sync_abseil.h )
s.files += %w( include/grpc/support/sync_custom.h )
s.files += %w( include/grpc/support/sync_generic.h )
s.files += %w( include/grpc/support/sync_posix.h )
@ -453,6 +455,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/string_windows.cc )
s.files += %w( src/core/lib/gpr/string_windows.h )
s.files += %w( src/core/lib/gpr/sync.cc )
s.files += %w( src/core/lib/gpr/sync_abseil.cc )
s.files += %w( src/core/lib/gpr/sync_posix.cc )
s.files += %w( src/core/lib/gpr/sync_windows.cc )
s.files += %w( src/core/lib/gpr/time.cc )

@ -466,6 +466,7 @@
'src/core/lib/gpr/string_util_windows.cc',
'src/core/lib/gpr/string_windows.cc',
'src/core/lib/gpr/sync.cc',
'src/core/lib/gpr/sync_abseil.cc',
'src/core/lib/gpr/sync_posix.cc',
'src/core/lib/gpr/sync_windows.cc',
'src/core/lib/gpr/time.cc',

@ -34,6 +34,13 @@
#define GRPC_USE_ABSL 1
#endif
/*
* Defines GPR_ABSEIL_SYNC to use synchronization features from Abseil
*/
#ifndef GPR_ABSEIL_SYNC
/* #define GPR_ABSEIL_SYNC 1 */
#endif
/* Get windows.h included everywhere (we need it) */
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
#ifndef WIN32_LEAN_AND_MEAN

@ -46,12 +46,14 @@ extern "C" {
#include <grpc/impl/codegen/sync_generic.h>
#if defined(GPR_POSIX_SYNC)
#if defined(GPR_CUSTOM_SYNC)
#include <grpc/impl/codegen/sync_custom.h>
#elif defined(GPR_ABSEIL_SYNC)
#include <grpc/impl/codegen/sync_abseil.h>
#elif defined(GPR_POSIX_SYNC)
#include <grpc/impl/codegen/sync_posix.h>
#elif defined(GPR_WINDOWS)
#include <grpc/impl/codegen/sync_windows.h>
#elif defined(GPR_CUSTOM_SYNC)
#include <grpc/impl/codegen/sync_custom.h>
#else
#error Unable to determine platform for sync
#endif

@ -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_IMPL_CODEGEN_SYNC_ABSEIL_H
#define GRPC_IMPL_CODEGEN_SYNC_ABSEIL_H
#include <grpc/impl/codegen/port_platform.h>
#include <grpc/impl/codegen/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_IMPL_CODEGEN_SYNC_ABSEIL_H */

@ -10,6 +10,7 @@ framework module grpc {
header "support/port_platform.h"
header "support/string_util.h"
header "support/sync.h"
header "support/sync_abseil.h"
header "support/sync_generic.h"
header "support/thd_id.h"
header "support/time.h"
@ -20,6 +21,7 @@ framework module grpc {
header "impl/codegen/log.h"
header "impl/codegen/port_platform.h"
header "impl/codegen/sync.h"
header "impl/codegen/sync_abseil.h"
header "impl/codegen/sync_generic.h"
header "impl/codegen/byte_buffer.h"
header "impl/codegen/byte_buffer_reader.h"
@ -36,6 +38,7 @@ framework module grpc {
header "impl/codegen/log.h"
header "impl/codegen/port_platform.h"
header "impl/codegen/sync.h"
header "impl/codegen/sync_abseil.h"
header "impl/codegen/sync_generic.h"
header "grpc_security.h"
header "byte_buffer.h"

@ -0,0 +1,26 @@
/*
*
* 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/impl/codegen/sync_abseil.h>
#endif /* GRPC_SUPPORT_SYNC_ABSEIL_H */

@ -56,6 +56,7 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/slice.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/status.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_abseil.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_custom.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_generic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_posix.h" role="src" />
@ -75,6 +76,7 @@
<file baseinstalldir="/" name="include/grpc/support/port_platform.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/string_util.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_abseil.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_custom.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_generic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_posix.h" role="src" />
@ -436,6 +438,7 @@
<file baseinstalldir="/" name="src/core/lib/gpr/string_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync_abseil.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/time.cc" role="src" />

@ -0,0 +1,114 @@
/*
*
* 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.
*
*/
#include <grpc/support/port_platform.h>
#if defined(GPR_ABSEIL_SYNC) && !defined(GPR_CUSTOM_SYNC)
#include <grpc/support/alloc.h>
#include <errno.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <time.h>
#include "src/core/lib/profiling/timers.h"
#include "absl/base/call_once.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#ifdef GPR_LOW_LEVEL_COUNTERS
gpr_atm gpr_mu_locks = 0;
gpr_atm gpr_counter_atm_cas = 0;
gpr_atm gpr_counter_atm_add = 0;
#endif
void gpr_mu_init(gpr_mu* mu) {
static_assert(sizeof(gpr_mu) == sizeof(absl::Mutex),
"gpr_mu and Mutex must be the same size");
new (mu) absl::Mutex;
}
void gpr_mu_destroy(gpr_mu* mu) {
reinterpret_cast<absl::Mutex*>(mu)->~Mutex();
}
void gpr_mu_lock(gpr_mu* mu) ABSL_NO_THREAD_SAFETY_ANALYSIS {
GPR_TIMER_SCOPE("gpr_mu_lock", 0);
reinterpret_cast<absl::Mutex*>(mu)->Lock();
}
void gpr_mu_unlock(gpr_mu* mu) ABSL_NO_THREAD_SAFETY_ANALYSIS {
GPR_TIMER_SCOPE("gpr_mu_unlock", 0);
reinterpret_cast<absl::Mutex*>(mu)->Unlock();
}
int gpr_mu_trylock(gpr_mu* mu) {
GPR_TIMER_SCOPE("gpr_mu_trylock", 0);
int ret = reinterpret_cast<absl::Mutex*>(mu)->TryLock() == true;
return ret;
}
/*----------------------------------------*/
void gpr_cv_init(gpr_cv* cv) {
static_assert(sizeof(gpr_cv) == sizeof(absl::CondVar),
"gpr_cv and CondVar must be the same size");
new (cv) absl::CondVar;
}
void gpr_cv_destroy(gpr_cv* cv) {
reinterpret_cast<absl::CondVar*>(cv)->~CondVar();
}
int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline) {
GPR_TIMER_SCOPE("gpr_cv_wait", 0);
if (gpr_time_cmp(abs_deadline, gpr_inf_future(abs_deadline.clock_type)) ==
0) {
reinterpret_cast<absl::CondVar*>(cv)->Wait(
reinterpret_cast<absl::Mutex*>(mu));
return 0;
}
abs_deadline = gpr_convert_clock_type(abs_deadline, GPR_CLOCK_REALTIME);
timespec ts = {static_cast<decltype(ts.tv_sec)>(abs_deadline.tv_sec),
static_cast<decltype(ts.tv_nsec)>(abs_deadline.tv_nsec)};
int ret = reinterpret_cast<absl::CondVar*>(cv)->WaitWithDeadline(
reinterpret_cast<absl::Mutex*>(mu),
absl::TimeFromTimespec(ts)) == true;
return ret;
}
void gpr_cv_signal(gpr_cv* cv) {
GPR_TIMER_MARK("gpr_cv_signal", 0);
reinterpret_cast<absl::CondVar*>(cv)->Signal();
}
void gpr_cv_broadcast(gpr_cv* cv) {
GPR_TIMER_MARK("gpr_cv_broadcast", 0);
reinterpret_cast<absl::CondVar*>(cv)->SignalAll();
}
/*----------------------------------------*/
void gpr_once_init(gpr_once* once, void (*init_function)(void)) {
absl::call_once(*reinterpret_cast<absl::once_flag*>(once), init_function);
}
#endif /* defined(GPR_ABSEIL_SYNC) && !defined(GPR_CUSTOM_SYNC) */

@ -18,15 +18,17 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/alloc.h>
#ifdef GPR_POSIX_SYNC
#if defined(GPR_POSIX_SYNC) && !defined(GPR_ABSEIL_SYNC) && \
!defined(GPR_CUSTOM_SYNC)
#include <errno.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <errno.h>
#include <time.h>
#include "src/core/lib/profiling/timers.h"
#ifdef GPR_LOW_LEVEL_COUNTERS
@ -170,4 +172,5 @@ void gpr_once_init(gpr_once* once, void (*init_function)(void)) {
GPR_ASSERT(pthread_once(once, init_function) == 0);
}
#endif /* GRP_POSIX_SYNC */
#endif /* defined(GPR_POSIX_SYNC) && !defined(GPR_ABSEIL_SYNC) && \
!defined(GPR_CUSTOM_SYNC) */

@ -20,7 +20,8 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_WINDOWS
#if defined(GPR_WINDOWS) && !defined(GPR_ABSEIL_SYNC) && \
!defined(GPR_CUSTOM_SYNC)
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@ -115,4 +116,5 @@ void gpr_once_init(gpr_once* once, void (*init_function)(void)) {
InitOnceExecuteOnce(once, run_once_func, &arg, &dummy);
}
#endif /* GPR_WINDOWS */
#endif /* defined(GPR_WINDOWS) && !defined(GPR_ABSEIL_SYNC) && \
!defined(GPR_CUSTOM_SYNC) */

@ -208,6 +208,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/gpr/string_util_windows.cc',
'src/core/lib/gpr/string_windows.cc',
'src/core/lib/gpr/sync.cc',
'src/core/lib/gpr/sync_abseil.cc',
'src/core/lib/gpr/sync_posix.cc',
'src/core/lib/gpr/sync_windows.cc',
'src/core/lib/gpr/time.cc',

@ -39,6 +39,7 @@
#include <grpc/impl/codegen/slice.h>
#include <grpc/impl/codegen/status.h>
#include <grpc/impl/codegen/sync.h>
#include <grpc/impl/codegen/sync_abseil.h>
#include <grpc/impl/codegen/sync_custom.h>
#include <grpc/impl/codegen/sync_generic.h>
#include <grpc/load_reporting.h>
@ -52,6 +53,7 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/sync_abseil.h>
#include <grpc/support/sync_custom.h>
#include <grpc/support/sync_generic.h>
#include <grpc/support/thd_id.h>

@ -900,6 +900,7 @@ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -919,6 +920,7 @@ include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \

@ -901,6 +901,7 @@ include/grpc/impl/codegen/propagation_bits.h \
include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \
@ -920,6 +921,7 @@ include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \

@ -842,6 +842,8 @@ include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
@ -865,6 +867,7 @@ include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \

@ -842,6 +842,8 @@ include/grpc/impl/codegen/slice.h \
include/grpc/impl/codegen/status.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_abseil.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_custom.h \
include/grpc/impl/codegen/sync_generic.h \
@ -865,6 +867,7 @@ include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
include/grpc/support/string_util.h \
include/grpc/support/sync.h \
include/grpc/support/sync_abseil.h \
include/grpc/support/sync_custom.h \
include/grpc/support/sync_generic.h \
include/grpc/support/sync_posix.h \
@ -1242,6 +1245,7 @@ src/core/lib/gpr/string_util_windows.cc \
src/core/lib/gpr/string_windows.cc \
src/core/lib/gpr/string_windows.h \
src/core/lib/gpr/sync.cc \
src/core/lib/gpr/sync_abseil.cc \
src/core/lib/gpr/sync_posix.cc \
src/core/lib/gpr/sync_windows.cc \
src/core/lib/gpr/time.cc \

Loading…
Cancel
Save