https://github.com/halide/Halide
Raw File
Tip revision: cd1e94d505f0d238b37f0012d53cc0e9bd2b44c9 authored by Steven Johnson on 07 February 2020, 22:56:56 UTC
Forbid debug_to_file() on vectorized Funcs (Issue #4596)
Tip revision: cd1e94d
windows_abort.cpp
#include "runtime_internal.h"

extern "C" void abort();
extern "C" void exit(int);
extern "C" int raise(int);

#define SIGABRT 22

namespace Halide {
namespace Runtime {
namespace Internal {

WEAK __attribute__((always_inline)) void halide_abort() {
    char *s = getenv("HL_DISABLE_WINDOWS_ABORT_DIALOG");
    if (s && atoi(s)) {
        // Debug variants of the MSVC runtime will present an "Abort, Retry, Ignore"
        // dialog in response to a call to abort(); we want to be able to disable this
        // for (e.g.) buildbots, where we never want that behavior. This is a close approximation
        // that will kill the process in a similar way.
        // (Note that 3 is the exit code for the "abort" button.)
        raise(SIGABRT);
        exit(3);
    }

    abort();
}

}  // namespace Internal
}  // namespace Runtime
}  // namespace Halide
back to top