-
Notifications
You must be signed in to change notification settings - Fork 58
Conversation
shengofsun
commented
Aug 6, 2018
- fix thread safety problem of strerror
- remove source code for windows
1. fix thread safety problem of strerror 2. remove code for windows
src/core/core/utils.cpp
Outdated
!defined _GNU_SOURCE) | ||
int result = strerror_r(err, errno_buffer, 256); | ||
if (result != 0) { | ||
printf("call strerror_r faild, old_err(%d), new_err(%d), ret(%d)\n", err, errno, result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不应该用 printf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前是在避免采用dlog系列。dlog系列实在是太毒瘤了,引用了就要依赖整个runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那也应该用 fprintf(stderr, )
啊,而且正常的基础库都会依赖一个日志库的,你也不能因为避免打日志就用 printf
另外 butil 了解一下: |
safe_strerror是我自己写的…… |
butin的safe_strerror内存拷贝次数有点多啊。不过虽然也不要紧,因为打印这个的时候都是出问题了的时候。 |
butil 拷贝再多也只是 256 bytes 的拷贝,我推荐这个主要还是因为它们从 chromium 拷过来的,注释写的比较充分,理论上也比较 stable。 |