feat: comment sophon doc in README #28
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
name: threading | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
reasoning: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy | |
override: true | |
- name: Repl | |
run: | | |
cargo build --features="repl" --release | |
- name: Thread Safe (still unsafe) | |
run: | | |
./target/release/3body -c ' | |
给 cx 以 程心(); | |
给 掩体工程进展 以 0; | |
给 研制曲率飞船进展 以 0; | |
cx.thread(法则() { | |
给 掩体纪年 以 0; | |
面壁 (掩体纪年 <= 11) { | |
冬眠(1000); | |
广播(["掩体工程进展", 掩体工程进展]); | |
掩体工程进展 = 掩体工程进展 + 1; | |
掩体纪年 = 掩体纪年 + 1; | |
} | |
}, []) | |
冬眠(5000) | |
cx.thread(法则() { | |
给 掩体纪年 以 5; | |
面壁 (掩体纪年 <= 11) { | |
冬眠(1000); | |
广播(["研制曲率飞船进展", 研制曲率飞船进展]); | |
研制曲率飞船进展 = 研制曲率飞船进展 + 1; | |
掩体纪年 = 掩体纪年 + 1; | |
} | |
}, []) | |
冬眠(6000)' | |
./target/release/3body -c ' | |
给 cx 以 程心(); | |
给 星环公司 以 法则(name, y, limit) { | |
给 掩体纪年 以 y; | |
面壁 (掩体纪年 <= limit) { | |
冬眠(1000); | |
广播([name, 掩体纪年]); | |
掩体纪年 = 掩体纪年 + 1; | |
} | |
} | |
给 秘密研究 以 cx.thread(星环公司, ["重启光速飞船的研究", 11, 66]) | |
cx.join(秘密研究)' | |
- name: Thread Unsafe | |
run: | | |
./target/release/3body -c ' | |
给 cx 以 程心(); | |
给 总进展 以 0; | |
cx.thread(法则() { | |
给 掩体纪年 以 0; | |
面壁 (掩体纪年 <= 11) { | |
冬眠(1000); | |
广播(["总进展", 总进展]); | |
总进展 = 总进展 + 1; // unsafe | |
掩体纪年 = 掩体纪年 + 1; | |
} | |
}, []) | |
冬眠(5000) | |
cx.thread(法则() { | |
给 掩体纪年 以 5; | |
面壁 (掩体纪年 <= 11) { | |
冬眠(1000); | |
广播(["总进展", 总进展]); | |
总进展 = 总进展 + 1; // unsafe | |
掩体纪年 = 掩体纪年 + 1; | |
} | |
}, []) | |
冬眠(6000) | |
广播([总进展])' |