https://github.com/halide/Halide
Raw File
Tip revision: 027547f713f6a01c7b51cb59baa665219f89751d authored by Steven Johnson on 22 June 2023, 22:31:28 UTC
Backport #7650 to the release/16.x branch (#7653)
Tip revision: 027547f
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