mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Rename signal_handler.odin to signal_handler_libc.odin
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
//+private
|
||||
//+build windows, linux, darwin, freebsd, openbsd, netbsd, haiku
|
||||
package testing
|
||||
|
||||
import "base:intrinsics"
|
||||
import "core:c/libc"
|
||||
|
||||
@(private="file")
|
||||
abort_flag: libc.sig_atomic_t
|
||||
|
||||
setup_signal_handler :: proc() {
|
||||
libc.signal(libc.SIGINT, proc "c" (sig: libc.int) {
|
||||
intrinsics.atomic_add(&abort_flag, 1)
|
||||
})
|
||||
}
|
||||
|
||||
should_abort :: proc() -> bool {
|
||||
return intrinsics.atomic_load(&abort_flag) > 0
|
||||
}
|
||||
Reference in New Issue
Block a user