1 #include "runtime_internal.h"
2
3 extern "C" void abort();
4 extern "C" void exit(int);
5 extern "C" int raise(int);
6
7 #define SIGABRT 22
8
halide_abort()9 extern "C" WEAK_INLINE void halide_abort() {
10 char *s = getenv("HL_DISABLE_WINDOWS_ABORT_DIALOG");
11 if (s && atoi(s)) {
12 // Debug variants of the MSVC runtime will present an "Abort, Retry, Ignore"
13 // dialog in response to a call to abort(); we want to be able to disable this
14 // for (e.g.) buildbots, where we never want that behavior. This is a close approximation
15 // that will kill the process in a similar way.
16 // (Note that 3 is the exit code for the "abort" button.)
17 raise(SIGABRT);
18 exit(3);
19 }
20
21 abort();
22 }
23