https://github.com/halide/Halide
Raw File
Tip revision: 6a2fa039123e1266f0e6facf4d942be9701eec65 authored by Alex Reinking on 28 June 2019, 15:52:16 UTC
Reorganizing code. Next step: implement fused stages.
Tip revision: 6a2fa03
destructors.cpp
#include "HalideRuntime.h"

#define INLINE inline __attribute__((weak)) __attribute__((always_inline)) __attribute__((used))

extern "C" {

INLINE void call_destructor(void *user_context, void (*fn)(void *user_context, void *object), void **object, bool should_call) {
    void *o = *object;
    *object = NULL;
    // Call the function
    if (o && should_call) {
        fn(user_context, o);
    }
}

}
back to top