• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--- Implementation of a GPU mutex class --------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIBC_SRC___SUPPORT_THREADS_GPU_MUTEX_H
10 #define LLVM_LIBC_SRC___SUPPORT_THREADS_GPU_MUTEX_H
11 
12 #include "src/__support/macros/attributes.h"
13 #include "src/__support/threads/mutex_common.h"
14 
15 namespace LIBC_NAMESPACE {
16 
17 /// Implementation of a simple passthrough mutex which guards nothing. A
18 /// complete Mutex locks in general cannot be implemented on the GPU. We simply
19 /// define the Mutex interface and require that only a single thread executes
20 /// code requiring a mutex lock.
21 struct Mutex {
MutexMutex22   LIBC_INLINE constexpr Mutex(bool, bool, bool, bool) {}
23 
lockMutex24   LIBC_INLINE MutexError lock() { return MutexError::NONE; }
unlockMutex25   LIBC_INLINE MutexError unlock() { return MutexError::NONE; }
resetMutex26   LIBC_INLINE MutexError reset() { return MutexError::NONE; }
27 };
28 
29 } // namespace LIBC_NAMESPACE
30 
31 #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_GPU_MUTEX_H
32