aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-01-16 15:12:34 +0000
committergingerBill <bill@gingerbill.org>2023-01-16 15:12:34 +0000
commit7416f72565c3b899da1c4914acb43ed92e574739 (patch)
tree62983186be5767276aa75c7a54ce20fd4cfad0b5 /src/llvm_backend.cpp
parentb51be71a6f49dcb413e6989893e3a7bf706ef99d (diff)
Make static value atomic too
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index bea659f2b..084c27635 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -467,10 +467,10 @@ gb_internal lbValue lb_map_get_proc_for_type(lbModule *m, Type *type) {
GB_ASSERT(*found != nullptr);
return {(*found)->value, (*found)->type};
}
- static u32 proc_index = 0;
+ static std::atomic<u32> proc_index;
char buf[32] = {};
- isize n = gb_snprintf(buf, 32, "__$map_get-%u", ++proc_index);
+ isize n = gb_snprintf(buf, 32, "__$map_get-%u", 1+proc_index.fetch_add(1));
char *str = gb_alloc_str_len(permanent_allocator(), buf, n-1);
String proc_name = make_string_c(str);