https://github.com/halide/Halide
Raw File
Tip revision: 083534f8d4b5fe4a835a33d9b9d69507f312be83 authored by Zalman Stern on 07 July 2018, 15:56:04 UTC
Add stdio.h includes per https://github.com/halide/Halide/issues/3102 .
Tip revision: 083534f
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