https://github.com/halide/Halide
Raw File
Tip revision: c07f3e888f69e329fe2432c8f6e38fe65cb5ead0 authored by Steven Johnson on 04 October 2018, 01:36:36 UTC
Merge branch 'master' into srj-f16
Tip revision: c07f3e8
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