Skip to content

Commit a165a10

Browse files
committed
1
1 parent d57eecb commit a165a10

3 files changed

Lines changed: 56 additions & 7 deletions

File tree

.github/workflows/macos.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,51 @@ jobs:
7979
run: cmake --build build --parallel $(sysctl -n hw.ncpu)
8080
- name: Test
8181
working-directory: build
82-
run: ctest --output-on-failure -LE perfile
82+
run: ctest --output-on-failure -LE perfile
83+
84+
# ── 探针(诊断用,允许失败,不 gate CI) ─────────────────────────
85+
# 测 macos-latest 自带 Apple Clang 的 libc++ 有没有 <stop_token> / jthread:
86+
# PLAIN OK → 默认就有,可去掉上面三个 job 的 Homebrew,回归原生工具链
87+
# PLAIN FAIL + EXP OK → 有但被实验开关挡着,正式 job 加 -fexperimental-library 即可省掉 Homebrew
88+
# 两者都 FAIL → Apple libc++ 确实没带,维持现在的 Homebrew LLVM 方案
89+
probe-apple-stop_token:
90+
runs-on: macos-latest
91+
continue-on-error: true
92+
steps:
93+
- name: Show Apple Clang
94+
run: clang++ --version
95+
- name: Probe <stop_token>
96+
run: |
97+
cat > probe.cpp <<'EOF'
98+
#include <version>
99+
#include <stop_token>
100+
#include <thread>
101+
int main() {
102+
#if defined(__cpp_lib_jthread) && defined(__cpp_lib_stop_token)
103+
std::stop_source src;
104+
std::jthread jt([](std::stop_token t) { (void)t; });
105+
src.request_stop();
106+
return src.get_token().stop_requested() ? 0 : 1;
107+
#else
108+
return 2; // 特性宏未定义
109+
#endif
110+
}
111+
EOF
112+
113+
echo "== Attempt 1: plain =="
114+
if clang++ -std=c++23 probe.cpp -o probe_plain; then
115+
echo "PLAIN: compile OK"
116+
./probe_plain && echo "PLAIN: runtime OK (feature macros present)" \
117+
|| echo "PLAIN: feature macros NOT defined (rc=$?)"
118+
else
119+
echo "PLAIN: compile FAIL"
120+
fi
121+
122+
echo "== Attempt 2: -fexperimental-library =="
123+
if clang++ -std=c++23 -fexperimental-library probe.cpp -o probe_exp; then
124+
echo "EXPERIMENTAL: compile OK"
125+
./probe_exp && echo "EXPERIMENTAL: runtime OK" \
126+
|| echo "EXPERIMENTAL: feature macros NOT defined (rc=$?)"
127+
else
128+
echo "EXPERIMENTAL: compile FAIL — Apple libc++ does not ship <stop_token>"
129+
fi

taskflowlite/core/graph.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// @file graph.hpp
1+
/// @file graph.hpp
22
/// @brief 任务图容器 Graph —— Work 节点的物理存储与生命周期管理。
33
/// @author wicyn
44
/// @contact https://github.com/wicyn
@@ -83,11 +83,7 @@ class Graph {
8383

8484
/// @brief D2 可视化导出。
8585
///
86-
/// 将图中所有节点及其边以 D2 格式输出。根据边类型应用不同样式:
87-
/// - Jump/MultiJump: 红色虚线
88-
/// - Branch/MultiBranch: 蓝色粗线
89-
/// - 普通边: 灰色
90-
///
86+
/// 将图中所有节点及其边以 D2 格式输出。
9187
/// @param ostream 输出流。
9288
void dump(std::ostream& ostream) const;
9389

taskflowlite/core/traits.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@
2323
#include <concepts>
2424
#include <functional>
2525
#include <type_traits>
26+
#include <version>
2627

2728
#include "forward.hpp"
2829

30+
#if !defined(__cpp_lib_jthread) || __cpp_lib_jthread < 201911L
31+
# error "TaskflowLite requires P0660 (std::jthread / std::stop_token / std::stop_source). Use a stdlib that provides it: libstdc++ 11+, libc++ 18+, or MSVC STL; on macOS use Homebrew LLVM if Apple Clang lacks it."
32+
#endif
33+
34+
2935
namespace tfl {
3036

3137
// ── std::unwrap_ref_decay_t<T> 行为速查 ──────────────────────────────

0 commit comments

Comments
 (0)