1 #include "stdio_impl.h"
2 #include "pthread_impl.h"
4 void __lockfile(FILE *f)
9 if (f->lock < 0) return;
10 tid = __pthread_self()->tid;
12 while (f->lockcount == INT_MAX);
16 while (a_cas(&f->lock, 0, tid))
17 if (spins) spins--, a_spin();
18 else __syscall(SYS_sched_yield);