summaryrefslogtreecommitdiff
path: root/libc/src/__support/threads/gpu/mutex.h
blob: c4a75907eed7c706e88cb1ca73086109948c5499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//===--- Implementation of a GPU mutex class --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC_SUPPORT_THREAD_GPU_MUTEX_H
#define LLVM_LIBC_SRC_SUPPORT_THREAD_GPU_MUTEX_H

#include "src/__support/macros/attributes.h"
#include "src/__support/threads/mutex_common.h"

namespace __llvm_libc {

/// Implementation of a simple passthrough mutex which guards nothing. A
/// complete Mutex locks in general cannot be implemented on the GPU. We simply
/// define the Mutex interface and require that only a single thread executes
/// code requiring a mutex lock.
struct Mutex {
  LIBC_INLINE constexpr Mutex(bool, bool, bool) {}

  LIBC_INLINE MutexError lock() { return MutexError::NONE; }
  LIBC_INLINE MutexError unlock() { return MutexError::NONE; }
  LIBC_INLINE MutexError reset() { return MutexError::NONE; }
};

} // namespace __llvm_libc

#endif