musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/stdio/flockfile.c
diff options
context:
space:
mode:
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);
+ }
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月13日 00:25:35 +0000

AltStyle によって変換されたページ (->オリジナル) /