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/macros/config.h" 14 #include "src/__support/threads/mutex_common.h" 15 16 namespace LIBC_NAMESPACE_DECL { 17 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. 22 struct Mutex { MutexMutex23 LIBC_INLINE constexpr Mutex(bool, bool, bool, bool) {} 24 lockMutex25 LIBC_INLINE MutexError lock() { return MutexError::NONE; } unlockMutex26 LIBC_INLINE MutexError unlock() { return MutexError::NONE; } resetMutex27 LIBC_INLINE MutexError reset() { return MutexError::NONE; } 28 }; 29 30 } // namespace LIBC_NAMESPACE_DECL 31 32 #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_GPU_MUTEX_H 33