https://github.com/halide/Halide
Raw File
Tip revision: 04cb3808d4ea36d8c8a2630e16a746893488326d authored by Steven Johnson on 12 October 2018, 19:28:36 UTC
Stage ctor should assert that definition is defined
Tip revision: 04cb380
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