mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 14:18:47 +00:00
Merge pull request #5558 from odin-lang/bill/init-fini-changes
`@(init)` & `@(finit)` Changes.
This commit is contained in:
Vendored
+3
-2
@@ -10,8 +10,9 @@ g_ctx: runtime.Context
|
||||
g_allocator: mem.Compat_Allocator
|
||||
|
||||
@(init)
|
||||
init_context :: proc() {
|
||||
g_ctx = context
|
||||
init_context :: proc "contextless" () {
|
||||
g_ctx = runtime.default_context()
|
||||
context = g_ctx
|
||||
|
||||
// Wrapping the allocator with the mem.Compat_Allocator so we can
|
||||
// mimic the realloc semantics.
|
||||
|
||||
Vendored
+1
-1
@@ -169,7 +169,7 @@ exit :: proc "c" (exit_code: c.int) -> ! {
|
||||
}
|
||||
|
||||
@(private, fini)
|
||||
finish_atexit :: proc "c" () {
|
||||
finish_atexit :: proc "contextless" () {
|
||||
n := intrinsics.atomic_exchange(&atexit_functions_count, 0)
|
||||
for function in atexit_functions[:n] {
|
||||
function()
|
||||
|
||||
Vendored
+2
-2
@@ -25,7 +25,7 @@ BINDINGS_VERSION :: [3]u32{BINDINGS_VERSION_MAJOR, BINDINGS_VERSION_MIN
|
||||
BINDINGS_VERSION_STRING :: "0.11.22"
|
||||
|
||||
@(init)
|
||||
version_check :: proc() {
|
||||
version_check :: proc "contextless" () {
|
||||
v: [3]u32
|
||||
version(&v.x, &v.y, &v.z)
|
||||
if v != BINDINGS_VERSION {
|
||||
@@ -43,7 +43,7 @@ version_check :: proc() {
|
||||
n += copy(buf[n:], "and executing `make`")
|
||||
}
|
||||
|
||||
panic(string(buf[:n]))
|
||||
panic_contextless(string(buf[:n]))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ import "base:runtime"
|
||||
g_context: runtime.Context
|
||||
|
||||
@(private="file", init)
|
||||
wgpu_init_allocator :: proc() {
|
||||
wgpu_init_allocator :: proc "contextless" () {
|
||||
if g_context.allocator.procedure == nil {
|
||||
g_context = runtime.default_context()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user