summaryrefslogtreecommitdiff
path: root/src/stdio/ftrylockfile.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-16 10:39:45 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-16 10:39:45 -0400
commit4d9cc0b399b1d6a146cb45e64c74b7ee562de7a6 (patch)
tree20619f38692d102d4e61d23f0c52f8ad144f29d6 /src/stdio/ftrylockfile.c
parent9dd7d7e3f6a90ae00e83fd98f30c48389c4f5ab2 (diff)
downloadmusl-4d9cc0b399b1d6a146cb45e64c74b7ee562de7a6.tar.gz
optimize file locking: avoid cache-polluting writes to global storage
Diffstat (limited to 'src/stdio/ftrylockfile.c')
-rw-r--r--src/stdio/ftrylockfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/ftrylockfile.c b/src/stdio/ftrylockfile.c
index 725b66e7..1d0a1ff8 100644
--- a/src/stdio/ftrylockfile.c
+++ b/src/stdio/ftrylockfile.c
@@ -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;