https://github.com/halide/Halide
Raw File
Tip revision: 601c778db92000eb42f878d03a01eb6f54d1dd6d authored by Andrew Adams on 13 July 2023, 16:14:54 UTC
Merge remote-tracking branch 'origin/main' into abadams/random_pipelines
Tip revision: 601c778
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