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_THREAD_GPU_MUTEX_H
10 #define LLVM_LIBC_SRC_SUPPORT_THREAD_GPU_MUTEX_H
12 #include "src/__support/macros/attributes.h"
13 #include "src/__support/threads/mutex_common.h"
15 namespace __llvm_libc
{
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.
22 LIBC_INLINE
constexpr Mutex(bool, bool, bool) {}
24 LIBC_INLINE MutexError
lock() { return MutexError::NONE
; }
25 LIBC_INLINE MutexError
unlock() { return MutexError::NONE
; }
26 LIBC_INLINE MutexError
reset() { return MutexError::NONE
; }
29 } // namespace __llvm_libc