[libc-commits] [libc] 9c78d92 - [libc][NFC] Remove the now used thread_attrib target.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Sat Jul 9 11:29:26 PDT 2022


Author: Siva Chandra Reddy
Date: 2022-07-09T18:28:28Z
New Revision: 9c78d925578fa37853514650e3ed2f8cbce3198c

URL: https://github.com/llvm/llvm-project/commit/9c78d925578fa37853514650e3ed2f8cbce3198c
DIFF: https://github.com/llvm/llvm-project/commit/9c78d925578fa37853514650e3ed2f8cbce3198c.diff

LOG: [libc][NFC] Remove the now used thread_attrib target.

Added: 
    libc/src/__support/threads/thread.cpp

Modified: 
    libc/src/__support/threads/CMakeLists.txt
    libc/src/__support/threads/linux/CMakeLists.txt
    libc/test/src/__support/threads/CMakeLists.txt
    libc/test/src/__support/threads/thread_detach_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/threads/CMakeLists.txt b/libc/src/__support/threads/CMakeLists.txt
index 04f028799b323..9bfcee4a3ace9 100644
--- a/libc/src/__support/threads/CMakeLists.txt
+++ b/libc/src/__support/threads/CMakeLists.txt
@@ -4,15 +4,6 @@ add_header_library(
     mutex_common.h
 )
 
-add_header_library(
-  thread_attrib
-  HDRS
-    thread_attrib.h
-  DEPENDS
-    libc.src.__support.common
-    libc.src.__support.CPP.atomic
-)
-
 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
   add_subdirectory(${LIBC_TARGET_OS})
 endif()
@@ -27,18 +18,21 @@ if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.mutex)
   )
 endif()
 
+add_header_library(
+  thread_common
+  HDRS
+    thread.h
+  DEPENDS
+    libc.src.__support.common
+    libc.src.__support.CPP.atomic
+)
+
 if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.thread)
   add_object_library(
     thread
-    HDRS
-      thread.h
     SRCS
-      ${LIBC_TARGET_OS}/thread.cpp
+      thread.cpp
     DEPENDS
-      .thread_attrib
-    COMPILE_OPTIONS
-      -O3
-      -fno-omit-frame-pointer # This allows us to sniff out the thread args from
-                              # the new thread's stack reliably.
+      .${LIBC_TARGET_OS}.thread
   )
 endif()

diff  --git a/libc/src/__support/threads/linux/CMakeLists.txt b/libc/src/__support/threads/linux/CMakeLists.txt
index 8b298025da345..058e7c2a369ed 100644
--- a/libc/src/__support/threads/linux/CMakeLists.txt
+++ b/libc/src/__support/threads/linux/CMakeLists.txt
@@ -20,14 +20,18 @@ add_header_library(
     libc.src.__support.threads.mutex_common
 )
 
-add_header_library(
+add_object_library(
   thread
-  HDRS
-    thread.h
+  SRCS
+    thread.cpp
   DEPENDS
     .futex_word_type
     libc.include.sys_syscall
     libc.src.__support.CPP.atomic
     libc.src.__support.CPP.error
-    libc.src.__support.threads.thread_attrib
+    libc.src.__support.threads.thread_common
+  COMPILE_OPTIONS
+    -O3
+    -fno-omit-frame-pointer # This allows us to sniff out the thread args from
+                            # the new thread's stack reliably.
 )

diff  --git a/libc/src/__support/threads/thread.cpp b/libc/src/__support/threads/thread.cpp
new file mode 100644
index 0000000000000..1ca78ece703dd
--- /dev/null
+++ b/libc/src/__support/threads/thread.cpp
@@ -0,0 +1,10 @@
+//===--- Definitions of common thread items ---------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// This file is currently emtpy. In future, declaration of a self thread object
+// etc. will be added here.

diff  --git a/libc/test/src/__support/threads/CMakeLists.txt b/libc/test/src/__support/threads/CMakeLists.txt
index c713e8677378b..528e9269b2abe 100644
--- a/libc/test/src/__support/threads/CMakeLists.txt
+++ b/libc/test/src/__support/threads/CMakeLists.txt
@@ -11,8 +11,4 @@ add_libc_unittest(
   DEPENDS
     libc.src.__support.threads.mutex
     libc.src.__support.threads.thread
-    libc.src.__support.threads.thread_attrib
-  COMPILE_OPTIONS
-    -O3
-    -fno-omit-frame-pointer
 )

diff  --git a/libc/test/src/__support/threads/thread_detach_test.cpp b/libc/test/src/__support/threads/thread_detach_test.cpp
index 060ee08533796..186cb8fedaf25 100644
--- a/libc/test/src/__support/threads/thread_detach_test.cpp
+++ b/libc/test/src/__support/threads/thread_detach_test.cpp
@@ -8,7 +8,6 @@
 
 #include "src/__support/threads/mutex.h"
 #include "src/__support/threads/thread.h"
-#include "src/__support/threads/thread_attrib.h"
 #include "utils/UnitTest/Test.h"
 
 __llvm_libc::Mutex mutex(false, false, false);
@@ -21,7 +20,7 @@ int func(void *) {
 
 TEST(LlvmLibcTestThreadTest, DetachSimpleTest) {
   mutex.lock();
-  __llvm_libc::Thread<int> th;
+  __llvm_libc::Thread th;
   th.run(func, nullptr, nullptr, 0);
 
   // Since |mutex| is held by the current thread, we guarantee that
@@ -35,7 +34,7 @@ TEST(LlvmLibcTestThreadTest, DetachSimpleTest) {
 
 TEST(LlvmLibcTestThreadTest, DetachCleanupTest) {
   mutex.lock();
-  __llvm_libc::Thread<int> th;
+  __llvm_libc::Thread th;
   ASSERT_EQ(0, th.run(func, nullptr, nullptr, 0));
 
   // Since |mutex| is held by the current thread, we will release it


        


More information about the libc-commits mailing list