chromium/third_party/xnnpack/src/src/xnnpack/mutex.h

// Copyright 2022 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.

#pragma once

#include "xnnpack.h"
#include "xnnpack/common.h"

#if XNN_PLATFORM_WINDOWS
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#elif XNN_PLATFORM_MACOS || XNN_PLATFORM_IOS
#include <dispatch/dispatch.h>
#else
#include <pthread.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

struct xnn_mutex {};

enum xnn_status xnn_mutex_init(struct xnn_mutex* mutex);
enum xnn_status xnn_mutex_lock(struct xnn_mutex* mutex);
enum xnn_status xnn_mutex_unlock(struct xnn_mutex* mutex);
enum xnn_status xnn_mutex_destroy(struct xnn_mutex* mutex);

#ifdef __cplusplus
} // extern "C"
#endif