diff options
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 0d4c92c2..a196c1ef 100644 --- a/src/stdio/flockfile.c +++ b/src/stdio/flockfile.c @@ -3,6 +3,8 @@ void flockfile(FILE *f) { - if (!libc.threaded) pthread_self(); - __lockfile(f); + while (ftrylockfile(f)) { + int owner = f->lock; + if (owner) __wait(&f->lock, &f->waiters, owner, 1); + } } |