atm64_windows.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. *
  3. * Copyright 2015 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_ATM64_WINDOWS_H
  19. #define GRPC_IMPL_CODEGEN_ATM64_WINDOWS_H
  20. /** Win32 variant of atm_platform.h */
  21. #include <grpc/impl/codegen/port_platform.h>
  22. typedef int64_t gpr_atm64;
  23. #define GPR_ATM64_MAX INT64_MAX
  24. #define GPR_ATM64_MIN INT64_MIN
  25. #define gpr_atm64_full_barrier MemoryBarrier
  26. static __inline gpr_atm64 gpr_atm64_acq_load(const gpr_atm64* p) {
  27. gpr_atm64 result = *p;
  28. gpr_atm64_full_barrier();
  29. return result;
  30. }
  31. static __inline gpr_atm64 gpr_atm64_no_barrier_load(const gpr_atm64* p) {
  32. return gpr_atm64_acq_load(p);
  33. }
  34. static __inline void gpr_atm64_rel_store(gpr_atm64* p, gpr_atm64 value) {
  35. gpr_atm64_full_barrier();
  36. *p = value;
  37. }
  38. static __inline void gpr_atm64_no_barrier_store(gpr_atm64* p, gpr_atm64 value) {
  39. gpr_atm64_rel_store(p, value);
  40. }
  41. #endif /* GRPC_IMPL_CODEGEN_ATM64_WINDOWS_H */