X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fstdio%2Fflockfile.c;h=a196c1efe0af11663f5e0537a0de1db02c3982ef;hp=1b6ef5806fb78818139a509f116664ac96f0cdb8;hb=c8cb6bcdf009e94c12c6e256b8e24a9bc5fdaf05;hpb=5eb0d33ec0f08b123c5c10877d6258d05fa9453a diff --git a/src/stdio/flockfile.c b/src/stdio/flockfile.c index 1b6ef580..a196c1ef 100644 --- a/src/stdio/flockfile.c +++ b/src/stdio/flockfile.c @@ -3,7 +3,8 @@ void flockfile(FILE *f) { - pthread_self(); - libc.lockfile = __lockfile; - __lockfile(f); + while (ftrylockfile(f)) { + int owner = f->lock; + if (owner) __wait(&f->lock, &f->waiters, owner, 1); + } }