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

This commit is contained in:
Rich Felker committed 2011-03-16 10:39:45 -04:00
1 parent 9dd7d7e3f6
commit 4d9cc0b399
2 files changed
+5 -3

No files matched your search

+4 -2
View File
@@ -3,7 +3,9 @@
void flockfile(FILE *f)
{
pthread_self();
libc.lockfile = __lockfile;
if (!libc.lockfile) {
pthread_self();
libc.lockfile = __lockfile;
}
__lockfile(f);
}
+1 -1
View File
@@ -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;