https://github.com/halide/Halide
Raw File
Tip revision: c8b85d529c7a86b0685cbfd5a08a6ea67e2de5e2 authored by Steven Johnson on 19 February 2019, 20:18:10 UTC
Merge branch 'master' into webassembly
Tip revision: c8b85d5
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