Browse Source

Use `thread_local_cleaner` API in `os2`

Feoramund 11 months ago
parent
commit
49606ec3ea
1 changed files with 5 additions and 0 deletions
  1. 5 0
      core/os/os2/allocators.odin

+ 5 - 0
core/os/os2/allocators.odin

@@ -61,3 +61,8 @@ TEMP_ALLOCATOR_GUARD :: #force_inline proc(loc := #caller_location) -> (runtime.
 	global_default_temp_allocator_index = (global_default_temp_allocator_index+1)%MAX_TEMP_ARENA_COUNT
 	global_default_temp_allocator_index = (global_default_temp_allocator_index+1)%MAX_TEMP_ARENA_COUNT
 	return tmp, loc
 	return tmp, loc
 }
 }
+
+@(init, private)
+init_thread_local_cleaner :: proc() {
+	runtime.add_thread_local_cleaner(temp_allocator_fini)
+}