std::thread problems

后端 未结 2 1991
太阳男子
太阳男子 2021-02-04 14:41

I think I have a kind really bad concepts problems. Why I simple get a lot of race conditions error with valgrind. First i thought that could be a bug, and I saw in forums that

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-04 15:20

    cout is a resource and should be mutex-ed (race condition if >1 thread of do_something() or other uses of cout)

提交回复
热议问题