sync.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. *
  3. * Copyright 2016 gRPC authors.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifndef GRPC_IMPL_CODEGEN_SYNC_H
  19. #define GRPC_IMPL_CODEGEN_SYNC_H
  20. // IWYU pragma: private, include <grpc/support/sync.h>
  21. /** Synchronization primitives for GPR.
  22. The type gpr_mu provides a non-reentrant mutex (lock).
  23. The type gpr_cv provides a condition variable.
  24. The type gpr_once provides for one-time initialization.
  25. The type gpr_event provides one-time-setting, reading, and
  26. waiting of a void*, with memory barriers.
  27. The type gpr_refcount provides an object reference counter,
  28. with memory barriers suitable to control
  29. object lifetimes.
  30. The type gpr_stats_counter provides an atomic statistics counter. It
  31. provides no memory barriers.
  32. */
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* Platform-specific type declarations of gpr_mu and gpr_cv. */
  37. #include <grpc/impl/codegen/port_platform.h>
  38. #include <grpc/impl/codegen/sync_generic.h> // IWYU pragma: export
  39. #if defined(GPR_CUSTOM_SYNC)
  40. #include <grpc/impl/codegen/sync_custom.h> // IWYU pragma: export
  41. #elif defined(GPR_ABSEIL_SYNC)
  42. #include <grpc/impl/codegen/sync_abseil.h> // IWYU pragma: export
  43. #elif defined(GPR_POSIX_SYNC)
  44. #include <grpc/impl/codegen/sync_posix.h> // IWYU pragma: export
  45. #elif defined(GPR_WINDOWS)
  46. #include <grpc/impl/codegen/sync_windows.h> // IWYU pragma: export
  47. #else
  48. #error Unable to determine platform for sync
  49. #endif
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* GRPC_IMPL_CODEGEN_SYNC_H */