feat: update boost thread 1.87.0 (#6099)

- add additional headers

---------

Signed-off-by: wep21 <daisuke.nishimatsu1021@gmail.com>
diff --git a/modules/boost.thread/1.87.0.bcr.1/MODULE.bazel b/modules/boost.thread/1.87.0.bcr.1/MODULE.bazel
new file mode 100644
index 0000000..f8139a4
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/MODULE.bazel
@@ -0,0 +1,39 @@
+module(
+    name = "boost.thread",
+    version = "1.87.0.bcr.1",
+    bazel_compatibility = [">=7.2.1"],
+    compatibility_level = 108700,
+)
+
+bazel_dep(name = "boost.algorithm", version = "1.87.0")
+bazel_dep(name = "boost.assert", version = "1.87.0")
+bazel_dep(name = "boost.atomic", version = "1.87.0")
+bazel_dep(name = "boost.bind", version = "1.87.0")
+bazel_dep(name = "boost.chrono", version = "1.87.0")
+bazel_dep(name = "boost.concept_check", version = "1.87.0")
+bazel_dep(name = "boost.config", version = "1.87.0")
+bazel_dep(name = "boost.container", version = "1.87.0")
+bazel_dep(name = "boost.container_hash", version = "1.87.0")
+bazel_dep(name = "boost.core", version = "1.87.0")
+bazel_dep(name = "boost.date_time", version = "1.87.0")
+bazel_dep(name = "boost.exception", version = "1.87.0")
+bazel_dep(name = "boost.function", version = "1.87.0")
+bazel_dep(name = "boost.intrusive", version = "1.87.0")
+bazel_dep(name = "boost.io", version = "1.87.0")
+bazel_dep(name = "boost.iterator", version = "1.87.0")
+bazel_dep(name = "boost.lexical_cast", version = "1.87.0")
+bazel_dep(name = "boost.move", version = "1.87.0")
+bazel_dep(name = "boost.optional", version = "1.87.0")
+bazel_dep(name = "boost.predef", version = "1.87.0")
+bazel_dep(name = "boost.preprocessor", version = "1.87.0")
+bazel_dep(name = "boost.smart_ptr", version = "1.87.0")
+bazel_dep(name = "boost.static_assert", version = "1.87.0")
+bazel_dep(name = "boost.system", version = "1.87.0")
+bazel_dep(name = "boost.throw_exception", version = "1.87.0")
+bazel_dep(name = "boost.tuple", version = "1.87.0")
+bazel_dep(name = "boost.type_traits", version = "1.87.0")
+bazel_dep(name = "boost.utility", version = "1.87.0")
+bazel_dep(name = "boost.winapi", version = "1.87.0")
+bazel_dep(name = "platforms", version = "0.0.10")
+bazel_dep(name = "rules_cc", version = "0.1.1")
+
diff --git a/modules/boost.thread/1.87.0.bcr.1/overlay/BUILD.bazel b/modules/boost.thread/1.87.0.bcr.1/overlay/BUILD.bazel
new file mode 100644
index 0000000..1986db5
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/overlay/BUILD.bazel
@@ -0,0 +1,168 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+package(default_visibility = ["//visibility:public"])
+
+_COMMON_DEPS = [
+    "@boost.assert",
+    "@boost.bind",
+    "@boost.chrono",
+    "@boost.config",
+    "@boost.core",
+    "@boost.date_time",
+    "@boost.move",
+    "@boost.system",
+    "@boost.type_traits",
+]
+
+_COMMON_HDRS = [
+    "include/boost/thread/*.hpp",
+    "include/boost/thread/concurrent_queues/*.hpp",
+    "include/boost/thread/concurrent_queues/detail/*.hpp",
+    "include/boost/thread/csbl/*.hpp",
+    "include/boost/thread/csbl/memory/*.hpp",
+    "include/boost/thread/detail/*.hpp",
+    "include/boost/thread/executors/*.hpp",
+    "include/boost/thread/executors/detail/*.hpp",
+    "include/boost/thread/futures/*.hpp",
+    "include/boost/thread/pthread/shared_mutex.hpp",
+]
+
+_WINDOWS_HDRS = [
+    "include/boost/thread/win32/*.hpp",
+]
+
+_POSIX_HDRS = [
+    "include/boost/thread/pthread/*.hpp",
+]
+
+_MAC_HDRS = [
+    "include/boost/thread/pthread/*.hpp",
+]
+
+_WINDOWS_SRCS = [
+    "src/win32/*.cpp",
+]
+
+_MAC_SRCS = [
+    "src/pthread/once.cpp",
+    "src/pthread/thread.cpp",
+]
+
+_POSIX_SRCS = [
+    "src/pthread/thread.cpp",
+    "src/pthread/once.cpp",
+]
+
+_COMMON_SRCS = [
+    "src/future.cpp",
+]
+
+_COMMON_EXCLUDE_SRCS = ["src/pthread/once_atomic.cpp"]
+
+cc_library(
+    name = "thread_posix",
+    srcs = glob(
+        _POSIX_SRCS + _COMMON_SRCS,
+        exclude = _COMMON_EXCLUDE_SRCS,
+    ),
+    hdrs = glob(_POSIX_HDRS + _COMMON_HDRS),
+    defines = [
+        "BOOST_THREAD_DONT_USE_ATOMIC",
+    ],
+    includes = ["include"],
+    linkopts = ["-lpthread"],
+    target_compatible_with = select({
+        "@platforms//os:windows": ["@platforms//:incompatible"],
+        "@platforms//os:macos": ["@platforms//:incompatible"],
+        "//conditions:default": [],
+    }),
+    deps = _COMMON_DEPS,
+)
+
+cc_library(
+    name = "thread_windows",
+    srcs = glob(
+        _WINDOWS_SRCS + _COMMON_SRCS,
+        exclude = _COMMON_EXCLUDE_SRCS,
+    ),
+    hdrs = glob(_WINDOWS_HDRS + _COMMON_HDRS),
+    defines = [
+        "BOOST_THREAD_WIN32",
+        "BOOST_THREAD_DONT_USE_ATOMIC",
+    ],
+    includes = ["include"],
+    linkopts = ["-DEFAULTLIB:shell32"],
+    local_defines = [
+        "BOOST_THREAD_BUILD_LIB",
+    ],
+    target_compatible_with = select({
+        "@platforms//os:windows": [],
+        "@platforms//os:macos": ["@platforms//:incompatible"],
+        "//conditions:default": ["@platforms//:incompatible"],
+    }),
+    deps = _COMMON_DEPS + [
+        "@boost.atomic",
+    ],
+)
+
+cc_library(
+    name = "thread_mac",
+    srcs = glob(
+        _MAC_SRCS + _COMMON_SRCS,
+        exclude = _COMMON_EXCLUDE_SRCS,
+    ),
+    hdrs = glob(_MAC_HDRS + _COMMON_HDRS),
+    defines = [
+        "BOOST_THREAD_DONT_USE_ATOMIC",
+    ],
+    includes = ["include"],
+    target_compatible_with = select({
+        "@platforms//os:windows": ["@platforms//:incompatible"],
+        "@platforms//os:macos": [],
+        "//conditions:default": ["@platforms//:incompatible"],
+    }),
+    deps = _COMMON_DEPS,
+)
+
+cc_library(
+    name = "boost.thread",
+    srcs = glob(
+        ["src/**/*.cpp"],
+        exclude = _POSIX_SRCS + _WINDOWS_SRCS + _MAC_SRCS + _COMMON_SRCS + _COMMON_EXCLUDE_SRCS,
+    ),
+    hdrs = glob(
+        [
+            "include/**/*.hpp",
+        ],
+        exclude = _POSIX_HDRS + _WINDOWS_HDRS + _MAC_HDRS + _COMMON_HDRS,
+    ),
+    includes = ["include"],
+    deps = [
+        "@boost.atomic",
+        "@boost.concept_check",
+        "@boost.container",
+        "@boost.container_hash",
+        "@boost.exception",
+        "@boost.function",
+        "@boost.io",
+        "@boost.optional",
+        "@boost.predef",
+        "@boost.preprocessor",
+        "@boost.smart_ptr",
+        "@boost.static_assert",
+        "@boost.throw_exception",
+        "@boost.tuple",
+        "@boost.utility",
+    ] + select({
+        "@platforms//os:windows": [
+            ":thread_windows",
+            "@boost.winapi",
+        ],
+        "@platforms//os:macos": [
+            ":thread_mac",
+        ],
+        "//conditions:default": [
+            ":thread_posix",
+        ],
+    }) + _COMMON_DEPS,
+)
diff --git a/modules/boost.thread/1.87.0.bcr.1/overlay/MODULE.bazel b/modules/boost.thread/1.87.0.bcr.1/overlay/MODULE.bazel
new file mode 120000
index 0000000..9b599e3
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/overlay/MODULE.bazel
@@ -0,0 +1 @@
+../MODULE.bazel
\ No newline at end of file
diff --git a/modules/boost.thread/1.87.0.bcr.1/overlay/test/BUILD.bazel b/modules/boost.thread/1.87.0.bcr.1/overlay/test/BUILD.bazel
new file mode 100644
index 0000000..6eb412c
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/overlay/test/BUILD.bazel
@@ -0,0 +1,193 @@
+load("@rules_cc//cc:defs.bzl", "cc_test")
+
+_TESTS = {
+    "test_366_1": [],
+    "test_366_2": [],
+    "test_366_3": [],
+    "test_366_4": [],
+    "test_2309": [],
+    "test_2501": [],
+    "test_2741": [],
+    "test_3628": [],
+    # Uses a function that is undefined "test_3837": [],
+    "test_4521": [],
+    "test_4648": [],
+    "test_4882": [],
+    "test_5351": [],
+    # Fails and it is unclear why. Needs further investigation. "test_5502": [],
+    "test_5542_1": [],
+    "test_5542_2": [],
+    "test_5542_3": [],
+    "test_5891": [],
+    "test_6170": [],
+    "test_6174": [],
+    "test_7160": [],
+    "test_7328": [],
+    "test_7571": [],
+    "test_7665": [],
+    "test_7666": [],
+    "test_7720": [],
+    "test_7755": [],
+    "test_8508": [],
+    # Misses malloc.h which is deprecated "test_8557": [],
+    "test_8586": [],
+    "test_8596": [],
+    "test_8600": [],
+    "test_8674": [],
+    "test_8943": [],
+    "test_8960": [],
+    "test_9079_a": [],
+    # Misses iostream "test_9079_b": [],
+    # Misses iostream "test_9192": ["@boost.interprocess"],
+    # Uses boost::future which cannot compile "test_9303": ["@boost.asio"],
+    "test_9319": [],
+    "test_9711": [],
+    "test_9856": [],
+    "test_10340": [],
+    # Fails and is unclear why. Needs further investigation. "test_10963": [],
+    "test_10964": [],
+    "test_11053": [],
+    "test_11256": [],
+    "test_11266": [],
+    "test_11499": [],
+    "test_11611": [],
+    "test_11796": [],
+    # Misses iostream "test_11818": [],
+    "test_12293": [],
+    "test_12949": [],
+    "test_13480b": ["@boost.variant"],
+    # Misses a nonexistent file from @boost.system "test_13561": [],
+    "test_barrier_size_fct": [],
+    "test_barrier_void_fct": [],
+    "test_barrier": [],
+    "test_completion_latch": [],
+    "test_condition_notify_all": [],
+    "test_condition_notify_one": [],
+    "test_condition_timed_wait_times_out": [],
+    "test_condition": [],
+    "test_futures": [],
+    "test_generic_locks": [],
+    "test_hardware_concurrency": [],
+    "test_latch": [],
+    "test_lock_concept": [],
+    "test_ml": [],
+    "test_ml2": [],
+    "test_move_function": [],
+    "test_mutex": [],
+    "test_once": [],
+    "test_physical_concurrency": [],
+    "test_scheduled_tp": [],
+    "test_scheduling_adaptor": [],
+    "test_shared_mutex_part_2": [],
+    "test_shared_mutex_timed_locks_chrono": [],
+    "test_shared_mutex": [],
+    "test_thread_exit": [],
+    "test_thread_id": [],
+    "test_thread_launching": [],
+    "test_thread_mf": [],
+    "test_thread_move_return": [],
+    "test_thread_move": [],
+    "test_thread_return_local": [],
+    "test_thread": [],
+    # Uses boost::future which cannot compile "test_time_jumps": [],
+    "test_tss": [],
+    "test_xtime": [],
+}
+
+_POSIX_ONLY_TESTS = {
+}
+
+_MAC_ONLY_TESTS = {
+    "test_6130": [],
+    "test_8455": [],
+}
+
+_WINDOWS_ONLY_TESTS = {
+    "test_6130": [],
+}
+
+[cc_test(
+    name = test,
+    srcs = ["{}.cpp".format(test), "util.inl"] + glob(["*.hpp"]),
+    defines = select({
+        "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"],
+        "@platforms//os:macos": [],
+        "//conditions:default": [],
+    }),
+    deps = [
+        "@boost.test",
+        "@boost.test//:unit_test_main",
+        "@boost.thread",
+    ] + _TESTS[test],
+    linkstatic = select({
+        # Windows needs to link statically to get rid of undefined symbols
+        "@platforms//os:windows": True,
+        "@platforms//os:macos": False,
+        # Posix needs to link statically to get rid of undefined symbols
+        "//conditions:default": True,
+    }),
+) for test in _TESTS]
+
+[cc_test(
+    name = "posix_{}".format(test),
+    srcs = ["{}.cpp".format(test), "util.inl"] + glob(["*.hpp"]),
+    defines = select({
+        "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"],
+        "@platforms//os:macos": [],
+        "//conditions:default": [],
+    }),
+    target_compatible_with = select({
+        "@platforms//os:windows": ["@platforms//:incompatible"],
+        "@platforms//os:macos": ["@platforms//:incompatible"],
+        "//conditions:default": [],
+    }),
+    deps = [
+        "@boost.test",
+        "@boost.test//:unit_test_main",
+        "@boost.thread",
+    ] + _POSIX_ONLY_TESTS[test],
+    # Posix needs to link statically to get rid of undefined symbols
+    linkstatic = True,
+) for test in _POSIX_ONLY_TESTS]
+
+[cc_test(
+    name = "mac_{}".format(test),
+    srcs = ["{}.cpp".format(test), "util.inl"] + glob(["*.hpp"]),
+    defines = select({
+        "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"],
+        "@platforms//os:macos": [],
+        "//conditions:default": [],
+    }),
+    target_compatible_with = select({
+        "@platforms//os:windows": ["@platforms//:incompatible"],
+        "@platforms//os:macos": [],
+        "//conditions:default": ["@platforms//:incompatible"],
+    }),
+    deps = [
+        "@boost.test",
+        "@boost.test//:unit_test_main",
+        "@boost.thread",
+    ] + _MAC_ONLY_TESTS[test],
+) for test in _MAC_ONLY_TESTS]
+
+[cc_test(
+    name = "windows_{}".format(test),
+    srcs = ["{}.cpp".format(test), "util.inl"] + glob(["*.hpp"]),
+    defines = select({
+        "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"],
+        "@platforms//os:macos": [],
+        "//conditions:default": [],
+    }),
+    target_compatible_with = select({
+        "@platforms//os:windows": [],
+        "@platforms//os:macos": ["@platforms//:incompatible"],
+        "//conditions:default": ["@platforms//:incompatible"],
+    }),
+    deps = [
+        "@boost.test",
+        "@boost.test//:unit_test_main",
+        "@boost.thread",
+    ] + _WINDOWS_ONLY_TESTS[test],
+    # Windows needs to link statically to get rid of undefined symbols
+    linkstatic = True,
+) for test in _WINDOWS_ONLY_TESTS]
diff --git a/modules/boost.thread/1.87.0.bcr.1/overlay/test/MODULE.bazel b/modules/boost.thread/1.87.0.bcr.1/overlay/test/MODULE.bazel
new file mode 100644
index 0000000..7e8317e
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/overlay/test/MODULE.bazel
@@ -0,0 +1,13 @@
+bazel_dep(name = "boost.asio", version = "1.87.0")
+bazel_dep(name = "boost.interprocess", version = "1.87.0")
+bazel_dep(name = "boost.test", version = "1.87.0")
+bazel_dep(name = "boost.thread")
+
+local_path_override(
+    module_name = "boost.thread",
+    path = "..",
+)
+
+bazel_dep(name = "boost.variant", version = "1.87.0")
+bazel_dep(name = "platforms", version = "0.0.10")
+bazel_dep(name = "rules_cc", version = "0.1.1")
diff --git a/modules/boost.thread/1.87.0.bcr.1/patches/fix_assert.patch b/modules/boost.thread/1.87.0.bcr.1/patches/fix_assert.patch
new file mode 100644
index 0000000..3d7e491
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/patches/fix_assert.patch
@@ -0,0 +1,12 @@
+diff --git include/boost/thread/pthread/pthread_helpers.hpp include/boost/thread/pthread/pthread_helpers.hpp
+index 68099941..2d60f829 100644
+--- include/boost/thread/pthread/pthread_helpers.hpp
++++ include/boost/thread/pthread/pthread_helpers.hpp
+@@ -7,6 +7,7 @@
+ //  accompanying file LICENSE_1_0.txt or copy at
+ //  http://www.boost.org/LICENSE_1_0.txt)
+ 
++#include <boost/assert.hpp>
+ #include <boost/thread/detail/config.hpp>
+ #include <boost/throw_exception.hpp>
+ #include <pthread.h>
diff --git a/modules/boost.thread/1.87.0.bcr.1/patches/fix_clang19.patch b/modules/boost.thread/1.87.0.bcr.1/patches/fix_clang19.patch
new file mode 100644
index 0000000..e1f78ff
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/patches/fix_clang19.patch
@@ -0,0 +1,13 @@
+diff --git include/boost/thread/future.hpp include/boost/thread/future.hpp
+index 00f504b9..d15d7ffa 100644
+--- include/boost/thread/future.hpp
++++ include/boost/thread/future.hpp
+@@ -4668,7 +4668,7 @@ namespace detail
+       }
+       run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT {
+         if (this != &x) {
+-          that_=x.that;
++          that_=x.that_;
+           x.that_.reset();
+         }
+         return *this;
diff --git a/modules/boost.thread/1.87.0.bcr.1/presubmit.yml b/modules/boost.thread/1.87.0.bcr.1/presubmit.yml
new file mode 100644
index 0000000..22675e7
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/presubmit.yml
@@ -0,0 +1,45 @@
+matrix:
+  platform:
+    - debian10
+    - debian11
+    - macos
+    - macos_arm64
+    - ubuntu2004
+    - ubuntu2204
+    - ubuntu2404
+    - windows
+  bazel: [7.x, 8.x, rolling]
+tasks:
+  verify_targets:
+    name: Verify build targets
+    platform: ${{ platform }}
+    bazel: ${{ bazel }}
+    build_flags:
+      - '--process_headers_in_dependencies'
+    build_targets:
+      - '@boost.thread//:boost.thread'
+
+bcr_test_module:
+  module_path: test
+  matrix:
+    platform:
+      - debian10
+      - debian11
+      - macos
+      - macos_arm64
+      - ubuntu2004
+      - ubuntu2204
+      - ubuntu2404
+      - windows
+    bazel: [7.x, 8.x, rolling]
+  tasks:
+    run_test_module:
+      name: Run test module
+      platform: ${{ platform }}
+      bazel: ${{ bazel }}
+      build_flags:
+        - '--process_headers_in_dependencies'
+      build_targets:
+        - //...
+      test_targets:
+        - //...
diff --git a/modules/boost.thread/1.87.0.bcr.1/source.json b/modules/boost.thread/1.87.0.bcr.1/source.json
new file mode 100644
index 0000000..54ec5e9
--- /dev/null
+++ b/modules/boost.thread/1.87.0.bcr.1/source.json
@@ -0,0 +1,16 @@
+{
+    "integrity": "sha256-XpM8SRrgpEa7P8YiJlta3npOPrR0LO04qYB4b70VJ0U=",
+    "strip_prefix": "thread-boost-1.87.0",
+    "url": "https://github.com/boostorg/thread/archive/refs/tags/boost-1.87.0.tar.gz",
+    "patch_strip": 0,
+    "overlay": {
+        "BUILD.bazel": "sha256-FL86lov1uUZJUmcFxr4rYdRm0k3TqYCUuxkr4KhbLjA=",
+        "MODULE.bazel": "sha256-PuZWdNT0Fq34UXngXp9N2roUmxf7g9KrzPKO+jofNUY=",
+        "test/BUILD.bazel": "sha256-hDHQt6H7E+evp01hiFXa0c0bUs61V9YBiHLS/QI5ooY=",
+        "test/MODULE.bazel": "sha256-Ia2LBwtZA97sRbMsXcCGt1ckTpOpDOmX1iXHVm21V0Q="
+    },
+    "patches": {
+        "fix_assert.patch": "sha256-dI4h1MBB+qjM08R8lXSXNgCL3b0AhX96WjNBV2b1c1A=",
+        "fix_clang19.patch": "sha256-1r+lQ/pumbhTXiOPd5UYsiHPfz9OjOdx5Hg+tPySh2A="
+    }
+}
diff --git a/modules/boost.thread/metadata.json b/modules/boost.thread/metadata.json
index 1017c60..8566325 100644
--- a/modules/boost.thread/metadata.json
+++ b/modules/boost.thread/metadata.json
@@ -22,6 +22,7 @@
         "1.83.0.bcr.1",
         "1.83.0.bcr.2",
         "1.87.0",
+        "1.87.0.bcr.1",
         "1.88.0.bcr.1",
         "1.89.0"
     ],