aboutsummaryrefslogtreecommitdiff
path: root/core/testing/signal_handler_posix.odin
blob: 0efba27dcd588d5d6b93970018e48a539558584c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
#+private
package testing

import "core:c/libc"
import "core:sys/posix"

__setup_signal_handler :: proc() {
	libc.signal(posix.SIGTRAP, stop_test_callback)
}

_test_thread_cancel :: proc "contextless" () {
	// NOTE(Feoramund): Some UNIX-like platforms may require this.
	//
	// During testing, I found that NetBSD 10.0 refused to
	// terminate a task thread, even when its thread had been
	// properly set to PTHREAD_CANCEL_ASYNCHRONOUS.
	//
	// The runner would stall after returning from `pthread_cancel`.

	posix.pthread_testcancel()
}