signal_handler_posix.odin 587 B

12345678910111213141516171819202122
  1. #+build linux, darwin, netbsd, openbsd, freebsd
  2. #+private
  3. package testing
  4. import "core:c/libc"
  5. import "core:sys/posix"
  6. __setup_signal_handler :: proc() {
  7. libc.signal(posix.SIGTRAP, stop_test_callback)
  8. }
  9. _test_thread_cancel :: proc "contextless" () {
  10. // NOTE(Feoramund): Some UNIX-like platforms may require this.
  11. //
  12. // During testing, I found that NetBSD 10.0 refused to
  13. // terminate a task thread, even when its thread had been
  14. // properly set to PTHREAD_CANCEL_ASYNCHRONOUS.
  15. //
  16. // The runner would stall after returning from `pthread_cancel`.
  17. posix.pthread_testcancel()
  18. }