https://github.com/halide/Halide
Raw File
Tip revision: 65c26cba6a3eca2d08a0bccf113ca28746012cc3 authored by Steven Johnson on 26 August 2019, 21:49:31 UTC
Merge pull request #4174 from halide/srj-tidy
Tip revision: 65c26cb
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