#ifndef HALIDE_RUNTIME_MUTEX_H
#define HALIDE_RUNTIME_MUTEX_H

#include "HalideRuntime.h"

// Avoid ODR violations
namespace {

// An RAII mutex
struct ScopedMutexLock {
    halide_mutex *mutex;

    ScopedMutexLock(halide_mutex *mutex) : mutex(mutex) {
        halide_mutex_lock(mutex);
    }

    ~ScopedMutexLock() {
        halide_mutex_unlock(mutex);
    }
};

}

#endif

Add an OS mutex to Halide runtime.
Add an OS mutex to Halide runtime.

Document an issue with the POSIX thread pool.

Ensure memoization cache is cleaned up when a JITted module is
shutdown. (Also provides a way to clear the cache from AOT code.)
