File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
libc/src/__support/threads Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ add_header_library (
2
+ mutex
3
+ HDRS
4
+ mutex.h
5
+ )
Original file line number Diff line number Diff line change
1
+ // ===--- Implementation of a mutex class for baremetal ----------*- 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_BAREMETAL_MUTEX_H
10
+ #define LLVM_LIBC_SRC___SUPPORT_THREADS_BAREMETAL_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. For
19
+ // / single threaded processors, this is the implementation.
20
+ struct Mutex {
21
+ LIBC_INLINE constexpr Mutex (bool , bool , bool , bool ) {}
22
+
23
+ LIBC_INLINE MutexError lock () { return MutexError::NONE; }
24
+ LIBC_INLINE MutexError unlock () { return MutexError::NONE; }
25
+ LIBC_INLINE MutexError reset () { return MutexError::NONE; }
26
+ };
27
+
28
+ // TODO: add multithreading support here
29
+
30
+ } // namespace LIBC_NAMESPACE_DECL
31
+
32
+ #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_BAREMETAL_MUTEX_H
Original file line number Diff line number Diff line change 41
41
#include " src/__support/threads/linux/mutex.h"
42
42
#elif defined(LIBC_TARGET_ARCH_IS_GPU)
43
43
#include " src/__support/threads/gpu/mutex.h"
44
+ #elif defined(__ELF__)
45
+ #include " src/__support/threads/baremetal/mutex.h"
44
46
#endif // __linux__
45
47
46
48
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_MUTEX_H
You can’t perform that action at this time.
0 commit comments