mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Require @(init) and @(fini) to be proc "contextless" ()
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
package runtime
|
||||
|
||||
Thread_Local_Cleaner :: #type proc "odin" ()
|
||||
Thread_Local_Cleaner_Odin :: #type proc "odin" ()
|
||||
Thread_Local_Cleaner_Contextless :: #type proc "contextless" ()
|
||||
|
||||
Thread_Local_Cleaner :: union #shared_nil {Thread_Local_Cleaner_Odin, Thread_Local_Cleaner_Contextless}
|
||||
|
||||
@(private="file")
|
||||
thread_local_cleaners: [8]Thread_Local_Cleaner
|
||||
|
||||
|
||||
// Add a procedure that will be run at the end of a thread for the purpose of
|
||||
// deallocating state marked as `thread_local`.
|
||||
//
|
||||
@@ -29,6 +33,9 @@ run_thread_local_cleaners :: proc "odin" () {
|
||||
if p == nil {
|
||||
break
|
||||
}
|
||||
p()
|
||||
switch v in p {
|
||||
case Thread_Local_Cleaner_Odin: v()
|
||||
case Thread_Local_Cleaner_Contextless: v()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user