我想创建一个 Windows 可执行文件。
我的程序使用异步库从网站并发下载文件。
我记得为了运行并发程序,我需要提供适当的标志,包括编译时和运行时。
对于控制台程序启动,我可以简单地做:
./myprogram.exe +RTS -N4
例如。
但是myprogram.exe
点击启动怎么办呢?
最佳答案
There are four ways to set RTS options:
- on the command line between +RTS ... -RTS, when running the program (Setting RTS options on the command line)
- at compile-time, using -with-rtsopts=⟨opts⟩ (Setting RTS options at compile time)
- with the environment variable GHCRTS (Setting RTS options with the GHCRTS environment variable)
- by overriding “hooks” in the runtime system (“Hooks” to change RTS behaviour)
第二颗子弹带你去你想去的地方。
此外,许多 RTS 选项都可以通过编程方式控制,以防您想在选择值之前进行一些计算——例如,检查有多少个物理 CPU。对于 -N
具体而言,有 setNumCapabilities
.
关于haskell - 如何在 Haskell 中使用 +RTS -N 创建可执行文件以实现并发?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66639231/