projects
/
musl
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
6b574cf0905f8ac4bd58458c2730d5e79b739634
[musl]
/
src
/
stdio
/
flockfile.c
1
#include "stdio_impl.h"
2
#include "pthread_impl.h"
3
4
#define MAYBE_WAITERS 0x40000000
5
6
void flockfile(FILE *f)
7
{
8
while (ftrylockfile(f)) {
9
int owner = f->lock;
10
if (!owner) continue;
11
a_cas(&f->lock, owner, owner|MAYBE_WAITERS);
12
__futexwait(&f->lock, owner|MAYBE_WAITERS, 1);
13
}
14
}