We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c64b55 commit 45a1c3aCopy full SHA for 45a1c3a
fuzztest/internal/domains/protobuf_domain_impl.h
@@ -15,6 +15,7 @@
15
#ifndef FUZZTEST_FUZZTEST_INTERNAL_DOMAINS_PROTOBUF_DOMAIN_IMPL_H_
16
#define FUZZTEST_FUZZTEST_INTERNAL_DOMAINS_PROTOBUF_DOMAIN_IMPL_H_
17
18
+#include <atomic>
19
#include <cstddef>
20
#include <cstdint>
21
#include <functional>
@@ -237,8 +238,8 @@ class ProtoPolicy {
237
238
ProtoPolicy()
239
: optional_policies_({{/*filter=*/IncludeAll<FieldDescriptor>(),
240
/*value=*/OptionalPolicy::kWithNull}}) {
- static int64_t next_id = 0;
241
- id_ = next_id++;
+ ABSL_CONST_INIT static std::atomic<int64_t> next_id{0};
242
+ id_ = next_id.fetch_add(1, std::memory_order_relaxed);
243
}
244
245
void SetOptionalPolicy(OptionalPolicy optional_policy) {
0 commit comments