我知道 errno 是线程安全的。而在Linux中,还有另外2个类似的函数,分别是strerror和strerror_r。根据 Robert Lover 的书 Linux System Programming
,strerror 不是线程安全的,但 strerror_r 是。所以我想知道 perror 是否是线程安全的。
最佳答案
在 POSIX 系统(如 Linux)中,perror
是线程安全的。
perror
在这里没有列为非线程安全:
All functions defined by this volume of POSIX.1-2008 shall be thread-safe, except that the following functions1 need not be thread-safe. [...]
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
关于c - perror 是线程安全的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24899502/