mirror of
git://git.musl-libc.org/musl
synced 2024-12-20 05:41:00 +00:00
optimize file locking: avoid cache-polluting writes to global storage
This commit is contained in:
parent
9dd7d7e3f6
commit
4d9cc0b399
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user