1 //===--- Implementation of a GPU mutex class --------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC___SUPPORT_THREADS_GPU_MUTEX_H
10 #define LLVM_LIBC_SRC___SUPPORT_THREADS_GPU_MUTEX_H
12 #include "src/__support/macros/attributes.h"
13 #include "src/__support/macros/config.h"
14 #include "src/__support/threads/mutex_common.h"
16 namespace LIBC_NAMESPACE_DECL
{
18 /// Implementation of a simple passthrough mutex which guards nothing. A
19 /// complete Mutex locks in general cannot be implemented on the GPU. We simply
20 /// define the Mutex interface and require that only a single thread executes
21 /// code requiring a mutex lock.
23 LIBC_INLINE
constexpr Mutex(bool, bool, bool, bool) {}
25 LIBC_INLINE MutexError
lock() { return MutexError::NONE
; }
26 LIBC_INLINE MutexError
unlock() { return MutexError::NONE
; }
27 LIBC_INLINE MutexError
reset() { return MutexError::NONE
; }
30 } // namespace LIBC_NAMESPACE_DECL
32 #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_GPU_MUTEX_H