diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-03-16 10:39:45 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-03-16 10:39:45 -0400 |
commit | 4d9cc0b399b1d6a146cb45e64c74b7ee562de7a6 (patch) | |
tree | 20619f38692d102d4e61d23f0c52f8ad144f29d6 /src/stdio/flockfile.c | |
parent | 9dd7d7e3f6a90ae00e83fd98f30c48389c4f5ab2 (diff) | |
download | musl-4d9cc0b399b1d6a146cb45e64c74b7ee562de7a6.tar.gz |
optimize file locking: avoid cache-polluting writes to global storage
Diffstat (limited to 'src/stdio/flockfile.c')
-rw-r--r-- | src/stdio/flockfile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stdio/flockfile.c b/src/stdio/flockfile.c index 1b6ef580..440a36a9 100644 --- a/src/stdio/flockfile.c +++ b/src/stdio/flockfile.c @@ -3,7 +3,9 @@ void flockfile(FILE *f) { - pthread_self(); - libc.lockfile = __lockfile; + if (!libc.lockfile) { + pthread_self(); + libc.lockfile = __lockfile; + } __lockfile(f); } |