https://github.com/halide/Halide
Raw File
Tip revision: f6779bd565fdd8e8e845a418e9c5900f0b4b181a authored by Ron Lieberman on 21 June 2018, 15:06:08 UTC
Move host_malloc_deinit inside destructor
Tip revision: f6779bd
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