-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc][NFC] Add the platform independent file target only if mutex is…
… available. The platform independent file implementation is not an entrypoint so it cannot be excluded via the entrypoints.txt file. Hence, we need a special treatment to exclude it from the build. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D121947
- Loading branch information
Siva Chandra Reddy
committed
Mar 18, 2022
1 parent
c80198b
commit c236b41
Showing
10 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
if(NOT (TARGET libc.src.__support.threads.mutex)) | ||
# Not all platforms have a mutex implementation. If mutex is unvailable, | ||
# we just skip everything about files. | ||
return() | ||
endif() | ||
|
||
add_object_library( | ||
file | ||
SRCS | ||
file.cpp | ||
HDRS | ||
file.h | ||
DEPENDS | ||
libc.src.__support.threads.thread | ||
libc.src.__support.threads.mutex | ||
libc.include.errno | ||
libc.src.errno.errno | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
add_header_library( | ||
mutex_common | ||
HDRS | ||
mutex_common.h | ||
) | ||
|
||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) | ||
add_subdirectory(${LIBC_TARGET_OS}) | ||
endif() | ||
|
||
add_header_library( | ||
thread | ||
HDRS | ||
mutex.h | ||
DEPENDS | ||
.${LIBC_TARGET_OS}.thread | ||
) | ||
if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.mutex) | ||
add_header_library( | ||
mutex | ||
HDRS | ||
mutex.h | ||
DEPENDS | ||
.${LIBC_TARGET_OS}.mutex | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
add_header_library( | ||
thread | ||
mutex | ||
HDRS | ||
mutex.h | ||
DEPENDS | ||
libc.include.sys_syscall | ||
libc.src.__support.CPP.atomic | ||
libc.src.__support.OSUtil.osutil | ||
libc.src.__support.threads.mutex_common | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===--- Common definitions useful for mutex implementations ----*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIBC_SRC_SUPPORT_THREAD_MUTEX_COMMON_H | ||
#define LLVM_LIBC_SRC_SUPPORT_THREAD_MUTEX_COMMON_H | ||
|
||
namespace __llvm_libc { | ||
|
||
enum class MutexError : int { | ||
NONE, | ||
BUSY, | ||
TIMEOUT, | ||
UNLOCK_WITHOUT_LOCK, | ||
BAD_LOCK_STATE, | ||
}; | ||
|
||
} // namespace __llvm_libc | ||
|
||
#endif // LLVM_LIBC_SRC_SUPPORT_THREAD_MUTEX_COMMON_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters