https://github.com/halide/Halide
Raw File
Tip revision: a0518f338c6c26b2464fa6d19d8707b567e4dded authored by Steven Johnson on 31 October 2022, 20:08:04 UTC
Merge branch 'main' into srj/pyapps
Tip revision: a0518f3
destructors.cpp
#include "HalideRuntime.h"
#include "printer.h"

extern "C" {

ALWAYS_INLINE __attribute__((used)) void call_destructor(void *user_context, void (*fn)(void *user_context, void *object), void **object, bool should_call) {
    void *o = *object;
    *object = nullptr;
    // Call the function
    if (o && should_call) {
        fn(user_context, o);
    }
}
}
back to top