[libcxx-commits] [PATCH] D96339: Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set.

Colin Finck via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 9 06:40:56 PST 2021


ColinFinck created this revision.
ColinFinck added a reviewer: libc++.
ColinFinck added a project: libc++.
Herald added subscribers: mstorsjo, mgorny.
ColinFinck requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

This allows building libc++ against winpthreads from mingw-w64 to support operating systems older than Windows 7.
The remaining libc++ code already supports `WIN32` with `LIBCXX_HAS_PTHREAD_API`.

Note that there is also the older "pthreads-win32". However, that support library implements `pthread_t` as a struct, which violates the libc++ assumption that `pthread_t` is always a scalar and can be compared, ordered, and set to zero.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96339

Files:
  libcxx/src/CMakeLists.txt


Index: libcxx/src/CMakeLists.txt
===================================================================
--- libcxx/src/CMakeLists.txt
+++ libcxx/src/CMakeLists.txt
@@ -77,8 +77,13 @@
   list(APPEND LIBCXX_SOURCES
     support/win32/locale_win32.cpp
     support/win32/support.cpp
-    support/win32/thread_win32.cpp
     )
+
+  if (NOT LIBCXX_HAS_PTHREAD_API)
+    list(APPEND LIBCXX_SOURCES
+      support/win32/thread_win32.cpp
+      )
+  endif()
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
   list(APPEND LIBCXX_SOURCES
     support/solaris/mbsnrtowcs.inc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96339.322378.patch
Type: text/x-patch
Size: 562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210209/bcd77ab6/attachment-0001.bin>


More information about the libcxx-commits mailing list