1 #include "stdio_impl.h"
2 #include "pthread_impl.h"
4 void __lockfile(FILE *f)
7 if (f->owner < 0) return;
8 if (f->owner && f->owner == __pthread_self()->tid) {
9 while (f->lockcount == INT_MAX);
14 while (a_swap(&f->lock, 1))
15 if (spins) spins--, a_spin();
16 else syscall(SYS_sched_yield);
17 f->owner = __pthread_self()->tid;