提交 4d9cc0b3 编写于 作者: R Rich Felker

optimize file locking: avoid cache-polluting writes to global storage

上级 9dd7d7e3
......@@ -3,7 +3,9 @@
void flockfile(FILE *f)
{
pthread_self();
libc.lockfile = __lockfile;
if (!libc.lockfile) {
pthread_self();
libc.lockfile = __lockfile;
}
__lockfile(f);
}
......@@ -3,7 +3,7 @@
int ftrylockfile(FILE *f)
{
libc.lockfile = __lockfile;
if (!libc.lockfile) libc.lockfile = __lockfile;
if (f->owner && f->owner == pthread_self()->tid) {
if (f->lockcount == INT_MAX)
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册