开发者

Are fprintf and fscanf reentrant when using different file handles

开发者 https://www.devze.com 2023-03-16 13:49 出处:网络
Can I have 2 threads in the same process calling fprintf or fscanf at the same time? One stream is wri开发者_运维问答tten to by the first thread and is read by the second thread and the otherstream i

Can I have 2 threads in the same process calling fprintf or fscanf at the same time?

One stream is wri开发者_运维问答tten to by the first thread and is read by the second thread and the other stream is read by the first thread and is written to by the second thread. So, I don't have a situation of simultaneous writes or simultaneous reads to the same stream.

If the answer is no - Do I have an reentrant alternative in the printf/scanf family?

This questions follows some comments in: Thread communication via printf and scanf (linux)


They are thread-safe. See http://www.unix.org/whitepapers/reentrant.html

0

精彩评论

暂无评论...
验证码 换一张
取 消