gpt4 book ai didi

c++ - openmp写入磁盘线程安全吗?

转载 作者:行者123 更新时间:2023-11-28 06:06:11 24 4
gpt4 key购买 nike

我的 C++ 程序伪代码如下所示:

#omp pragma parallel
for (i=1...100000)
write input files into a file called "$i.txt", $i is the value of i
then do ./outside_program $i.txt and reads its inputs and do other stuff

假设 ./outside_program 是线程安全的。使用 openmpC++ 中写入不同的文件是否线程安全?

最佳答案

如果您正在写入不同的文件,我认为没有问题,它是线程安全的。这个问题实际上不依赖于您使用的多线程 API。 OpenMP、TBB 或其他技术...

关于c++ - openmp写入磁盘线程安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32384244/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com